Blame SOURCES/memcached-restart-double-free.patch

6dacf3
commit 0d4901071c74f9c3b63162ef5887a5c5b981f385
6dacf3
Author: David Carlier <devnexen@gmail.com>
6dacf3
Date:   Sat Feb 22 01:24:54 2020 +0000
6dacf3
6dacf3
    restart: fix potential double free
6dacf3
6dacf3
diff --git a/restart.c b/restart.c
6dacf3
index 92a7295..9a83d3a 100644
6dacf3
--- a/restart.c
6dacf3
+++ b/restart.c
6dacf3
@@ -148,6 +148,7 @@ enum restart_get_kv_ret restart_get_kv(void *ctx, char **key, char **val) {
6dacf3
     // have to re-assign it into the structure anyway.
6dacf3
     if (c->line != NULL) {
6dacf3
         free(c->line);
6dacf3
+        c->line = NULL;
6dacf3
     }
6dacf3
 
6dacf3
     if (getline(&line, &len, c->f) != -1) {
6dacf3
@@ -198,6 +199,7 @@ enum restart_get_kv_ret restart_get_kv(void *ctx, char **key, char **val) {
6dacf3
         } else {
6dacf3
             // FIXME: proper error chain.
6dacf3
             fprintf(stderr, "[restart] invalid metadata line:\n\n%s\n", line);
6dacf3
+            free(line);
6dacf3
             return RESTART_BADLINE;
6dacf3
         }
6dacf3
     } else {