aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2019-05-18 09:34:04 +0200
committerPeter Wu <peter@lekensteyn.nl>2019-05-20 12:49:37 +0000
commit40f6cb70e9cc4c4d9826e8618e948b39efe1e8e9 (patch)
tree7e32440a67dc6b3a5a84e59f4f2fe8c767401dd6 /extcap.c
parent92dede59a52d6503d417798fd03736a31c9c82a0 (diff)
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>
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/extcap.c b/extcap.c
index 58ebe8075f..64c44a8413 100644
--- a/extcap.c
+++ b/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);