forked from osmocom/wireshark
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>
This commit is contained in:
parent
5689136fc6
commit
e803f83ac8
4
extcap.c
4
extcap.c
|
@ -1151,12 +1151,14 @@ extcap_has_toolbar(const char *ifname)
|
||||||
for (GList *walker = toolbar_list; walker; walker = walker->next)
|
for (GList *walker = toolbar_list; walker; walker = walker->next)
|
||||||
{
|
{
|
||||||
iface_toolbar *toolbar = (iface_toolbar *) walker->data;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_list_free(toolbar_list);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue