1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Free list in error case in parse_options

Fix memleaks.

Regards https://github.com/profanity-im/profanity/issues/1019
This commit is contained in:
Michael Vetter 2019-10-06 18:12:50 +02:00
parent 700f97d78c
commit b591f0cf2b

View File

@ -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;
}