From 962750eb64c7f968a03c4f57541d864f2418fcaf Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 30 Sep 2017 10:15:58 -0700 Subject: [PATCH] Fix memory leak when config conversion fails (#3006) This happens on an empty config file, for example. --- src/config_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config_parser.c b/src/config_parser.c index 58a5552c..9d8369c8 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -764,6 +764,7 @@ static char *migrate_config(char *input, off_t size) { wait(&status); if (!WIFEXITED(status)) { fprintf(stderr, "Child did not terminate normally, using old config file (will lead to broken behaviour)\n"); + FREE(converted); return NULL; } @@ -778,6 +779,7 @@ static char *migrate_config(char *input, off_t size) { fprintf(stderr, "# i3 config file (v4)\n"); /* TODO: nag the user with a message to include a hint for i3 in their config file */ } + FREE(converted); return NULL; } -- 2.39.5