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

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