about summary refs log tree commit diff stats
path: root/src/tools/parser.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-10-06 18:12:50 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-10-06 18:12:50 +0200
commitb591f0cf2b0ca1af29459f143d0e9e5fe5a99790 (patch)
tree07d4c2dbf3eaec28b82443f7aa5fcf67845c7265 /src/tools/parser.c
parent700f97d78c2a53d5614d5e33c6503f60c1573167 (diff)
downloadprofani-tty-b591f0cf2b0ca1af29459f143d0e9e5fe5a99790.tar.gz
Free list in error case in parse_options
Fix memleaks.

Regards https://github.com/profanity-im/profanity/issues/1019
Diffstat (limited to 'src/tools/parser.c')
-rw-r--r--src/tools/parser.c3
1 files changed, 3 insertions, 0 deletions
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;
         }