mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 08:26:22 +00: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:
@@ -415,6 +415,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res)
|
|||||||
// check if option valid
|
// check if option valid
|
||||||
if (g_list_find_custom(keys, args[curr], (GCompareFunc)g_strcmp0) == NULL) {
|
if (g_list_find_custom(keys, args[curr], (GCompareFunc)g_strcmp0) == NULL) {
|
||||||
*res = FALSE;
|
*res = FALSE;
|
||||||
|
g_list_free(found_keys);
|
||||||
g_list_free(keys);
|
g_list_free(keys);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@@ -422,6 +423,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res)
|
|||||||
// check if duplicate
|
// check if duplicate
|
||||||
if (g_list_find_custom(found_keys, args[curr], (GCompareFunc)g_strcmp0)) {
|
if (g_list_find_custom(found_keys, args[curr], (GCompareFunc)g_strcmp0)) {
|
||||||
*res = FALSE;
|
*res = FALSE;
|
||||||
|
g_list_free(found_keys);
|
||||||
g_list_free(keys);
|
g_list_free(keys);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@@ -429,6 +431,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res)
|
|||||||
// check value given
|
// check value given
|
||||||
if (args[curr+1] == NULL) {
|
if (args[curr+1] == NULL) {
|
||||||
*res = FALSE;
|
*res = FALSE;
|
||||||
|
g_list_free(found_keys);
|
||||||
g_list_free(keys);
|
g_list_free(keys);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user