From b591f0cf2b0ca1af29459f143d0e9e5fe5a99790 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Sun, 6 Oct 2019 18:12:50 +0200 Subject: Free list in error case in parse_options Fix memleaks. Regards https://github.com/profanity-im/profanity/issues/1019 --- src/tools/parser.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/tools/parser.c') diff --git a/src/tools/parser.c b/src/tools/parser.c index c6e1b73e..15cbeef5 100644 --- a/src/tools/parser.c +++ b/src/tools/parser.c @@ -415,6 +415,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res) // check if option valid if (g_list_find_custom(keys, args[curr], (GCompareFunc)g_strcmp0) == NULL) { *res = FALSE; + g_list_free(found_keys); g_list_free(keys); return options; } @@ -422,6 +423,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res) // check if duplicate if (g_list_find_custom(found_keys, args[curr], (GCompareFunc)g_strcmp0)) { *res = FALSE; + g_list_free(found_keys); g_list_free(keys); return options; } @@ -429,6 +431,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res) // check value given if (args[curr+1] == NULL) { *res = FALSE; + g_list_free(found_keys); g_list_free(keys); return options; } -- cgit 1.4.1-2-gfad0