forked from osmocom/wireshark
extcap: Fix memory leak in extcap_get_if_configuration_values()
The content of the list returned by g_hash_table_get_keys() is owned by GHashTable and should not be modified or freed. However, the list itself should be freed using g_list_free(). This fixes memory leak that happened on every selector option reload. Change-Id: Id91055264fed9f7b8ab8dba9292d5f35389ca235 Reviewed-on: https://code.wireshark.org/review/33244 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
92dede59a5
commit
40f6cb70e9
8
extcap.c
8
extcap.c
|
@ -995,13 +995,15 @@ extcap_get_if_configuration_values(const char * ifname, const char * argname, GH
|
|||
if ( arguments )
|
||||
{
|
||||
GList * keys = g_hash_table_get_keys(arguments);
|
||||
while ( keys )
|
||||
GList * walker = g_list_first(keys);
|
||||
while ( walker )
|
||||
{
|
||||
const gchar * key_data = (const gchar *)keys->data;
|
||||
const gchar * key_data = (const gchar *)walker->data;
|
||||
args = g_list_append(args, g_strdup(key_data));
|
||||
args = g_list_append(args, g_strdup((const gchar *)g_hash_table_lookup(arguments, key_data)));
|
||||
keys = g_list_next(keys);
|
||||
walker = g_list_next(walker);
|
||||
}
|
||||
g_list_free(keys);
|
||||
}
|
||||
|
||||
extcap_run_one(interface, args, cb_reload_preference, &ret, NULL);
|
||||
|
|
Loading…
Reference in New Issue