diff options
author | David Carlier <devnexen@gmail.com> | 2020-02-22 01:24:54 +0000 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2020-02-26 11:32:00 -0800 |
commit | 0d4901071c74f9c3b63162ef5887a5c5b981f385 (patch) | |
tree | 75b91259d94c1860af7922ea07f33337960b22f5 | |
parent | 05721e4b6c393f25830021bb13f6637e5747dfcc (diff) | |
download | memcached-0d4901071c74f9c3b63162ef5887a5c5b981f385.tar.gz |
restart: fix potential double free
-rw-r--r-- | restart.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -148,6 +148,7 @@ enum restart_get_kv_ret restart_get_kv(void *ctx, char **key, char **val) { // have to re-assign it into the structure anyway. if (c->line != NULL) { free(c->line); + c->line = NULL; } if (getline(&line, &len, c->f) != -1) { @@ -198,6 +199,7 @@ enum restart_get_kv_ret restart_get_kv(void *ctx, char **key, char **val) { } else { // FIXME: proper error chain. fprintf(stderr, "[restart] invalid metadata line:\n\n%s\n", line); + free(line); return RESTART_BADLINE; } } else { |