From 5c0003a980f2f6de474b225aa99229701e7f3c11 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Thu, 19 Jan 2017 22:32:51 +0100 Subject: disabled_protos: add cleanup function. Change-Id: I7d585404463691946e2aa67e14e53edb813d9be8 Reviewed-on: https://code.wireshark.org/review/19681 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo --- epan/disabled_protos.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'epan/disabled_protos.c') diff --git a/epan/disabled_protos.c b/epan/disabled_protos.c index ae6b5101e8..b38ad425a0 100644 --- a/epan/disabled_protos.c +++ b/epan/disabled_protos.c @@ -942,6 +942,27 @@ proto_enable_heuristic_by_name(const char *name, gboolean enable) } } +static void +disabled_protos_free(gpointer p, gpointer user_data _U_) +{ + protocol_def* pd = (protocol_def*)p; + g_free(pd->name); + g_free(p); +} + +void +disabled_protos_cleanup(void) +{ + g_list_foreach(global_disabled_heuristics, disabled_protos_free, NULL); + g_list_free(global_disabled_heuristics); + g_list_foreach(disabled_heuristics, disabled_protos_free, NULL); + g_list_free(disabled_heuristics); + g_list_foreach(global_disabled_protos, disabled_protos_free, NULL); + g_list_free(global_disabled_protos); + g_list_foreach(disabled_protos, disabled_protos_free, NULL); + g_list_free(disabled_protos); +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * -- cgit v1.2.1