From: Michael Stapelberg Date: Sat, 30 Sep 2017 17:15:58 +0000 (-0700) Subject: Fix memory leak when config conversion fails (#3006) X-Git-Tag: 4.15~58 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=962750eb64c7f968a03c4f57541d864f2418fcaf;p=i3%2Fi3 Fix memory leak when config conversion fails (#3006) This happens on an empty config file, for example. --- 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; }