summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2020-02-22 01:24:54 +0000
committerdormando <dormando@rydia.net>2020-02-26 11:32:00 -0800
commit0d4901071c74f9c3b63162ef5887a5c5b981f385 (patch)
tree75b91259d94c1860af7922ea07f33337960b22f5
parent05721e4b6c393f25830021bb13f6637e5747dfcc (diff)
downloadmemcached-0d4901071c74f9c3b63162ef5887a5c5b981f385.tar.gz
restart: fix potential double free
-rw-r--r--restart.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/restart.c b/restart.c
index 92a7295..9a83d3a 100644
--- a/restart.c
+++ b/restart.c
@@ -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 {