aboutsummaryrefslogtreecommitdiffstats
path: root/epan/funnel.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-01-28 09:16:32 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2019-01-28 10:57:30 +0000
commit6cab8c57bd0174ffbba203d456d8b10bd3fa02a5 (patch)
tree1ee3d6240c53ea793688ec8a1c8ef4fe56849efa /epan/funnel.c
parent5b226240c6586b10dccf4ec573f9732097bebcd6 (diff)
funnel: Fix memleaks in funnel_remove_menu
The loop to remove all matching callbacks was skipping every second entry which would give some leaks when reloading Lua plugins. Add funnel_cleanup() to be called in epan_cleanup() at shutdown to remove all allocated menu entries. Change-Id: I3a50ba2070c8675fee1385f25e9e109db57c2dc5 Reviewed-on: https://code.wireshark.org/review/31769 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/funnel.c')
-rw-r--r--epan/funnel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/epan/funnel.c b/epan/funnel.c
index dd96db79cd..a021106612 100644
--- a/epan/funnel.c
+++ b/epan/funnel.c
@@ -62,7 +62,7 @@ static void funnel_remove_menu (funnel_menu_t ** menu_list, funnel_menu_t *menu)
if (p) {
m = p->next;
} else {
- m = *menu_list ? (*menu_list)->next : NULL;
+ m = *menu_list;
}
} else {
p = m;
@@ -139,6 +139,11 @@ void funnel_reload_menus(funnel_deregistration_cb_t d_cb,
funnel_clear_menu(&added_menus);
}
+void funnel_cleanup(void)
+{
+ funnel_clear_menu(&registered_menus);
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*