diff options
author | Tomasz Moń <desowin@gmail.com> | 2019-05-16 18:09:36 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-05-20 13:37:37 +0000 |
commit | c52776da62b562a9bc8dff4464b0ce33dcb3234e (patch) | |
tree | dcfa7c93c7fa68e2521a72ff5dc46029a42efc5d /extcap.c | |
parent | a115d2b4838d9ad7fc51b2031e7a55eca950ab4a (diff) |
extcap: Fix memory leak in extcap_get_descriptions()
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().
Change-Id: I272616924bfd9178a925878a0458a173aff403ba
Reviewed-on: https://code.wireshark.org/review/33222
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'extcap.c')
-rw-r--r-- | extcap.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -189,7 +189,8 @@ extcap_get_descriptions(plugin_description_callback callback, void *callback_dat GPtrArray *tools_array = g_ptr_array_new(); if (tools && g_hash_table_size(tools) > 0) { - GList * walker = g_list_first(g_hash_table_get_keys(tools)); + GList * keys = g_hash_table_get_keys(tools); + GList * walker = g_list_first(keys); while (walker && walker->data) { extcap_info * tool = (extcap_info *)g_hash_table_lookup(tools, walker->data); if (tool) { @@ -197,6 +198,7 @@ extcap_get_descriptions(plugin_description_callback callback, void *callback_dat } walker = g_list_next(walker); } + g_list_free(keys); } g_ptr_array_sort(tools_array, compare_tools); |