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

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