aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2019-05-18 10:01:37 +0200
committerPeter Wu <peter@lekensteyn.nl>2019-05-20 13:19:37 +0000
commite803f83ac8f6f55247ce99a57bbfa8633019e4d7 (patch)
treef3a86d2361ea3bd7beaa10303cd86aa65d689db3 /extcap.c
parent5689136fc6e6d211a3341ac18b5fcbe0a3b71537 (diff)
extcap: Fix memory leak in extcap_has_toolbar()
The content of the list returned by g_hash_table_get_values() is owned by GHashTable and should not be modified or freed. However, the list itself should be freed using g_list_free(). Use g_strcmp0() to compare keys instead of strcmp() as it handles NULL gracefully. Change-Id: I8f5d70ffc2cd6eb5001b5086e4e31256b65431c7 Reviewed-on: https://code.wireshark.org/review/33246 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/extcap.c b/extcap.c
index 64c44a8413..5fd5ffacb3 100644
--- a/extcap.c
+++ b/extcap.c
@@ -1151,12 +1151,14 @@ extcap_has_toolbar(const char *ifname)
for (GList *walker = toolbar_list; walker; walker = walker->next)
{
iface_toolbar *toolbar = (iface_toolbar *) walker->data;
- if (g_list_find_custom(toolbar->ifnames, ifname, (GCompareFunc) strcmp))
+ if (g_list_find_custom(toolbar->ifnames, ifname, (GCompareFunc) g_strcmp0))
{
+ g_list_free(toolbar_list);
return TRUE;
}
}
+ g_list_free(toolbar_list);
return FALSE;
}