summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-01-19 22:32:51 +0100
committerDario Lombardo <lomato@gmail.com>2017-01-20 08:49:00 +0000
commit5c0003a980f2f6de474b225aa99229701e7f3c11 (patch)
treeadd2fac08e75e2265d29c00615b1d8faa2e4064f
parent387e7af2180327774beaa86cee3f9528146141cf (diff)
downloadwireshark-5c0003a980f2f6de474b225aa99229701e7f3c11.tar.gz
disabled_protos: add cleanup function.
Change-Id: I7d585404463691946e2aa67e14e53edb813d9be8 Reviewed-on: https://code.wireshark.org/review/19681 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
-rw-r--r--epan/disabled_protos.c21
-rw-r--r--epan/disabled_protos.h5
-rw-r--r--epan/epan.c2
3 files changed, 28 insertions, 0 deletions
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
*
diff --git a/epan/disabled_protos.h b/epan/disabled_protos.h
index 656a0f0427..52a791bfa7 100644
--- a/epan/disabled_protos.h
+++ b/epan/disabled_protos.h
@@ -150,6 +150,11 @@ save_disabled_heur_dissector_list(char **pref_path_return, int *errno_return);
WS_DLL_PUBLIC void
proto_enable_heuristic_by_name(const char *name, gboolean enable);
+/*
+ * Free the internal structures
+ */
+extern void
+disabled_protos_cleanup(void);
#ifdef __cplusplus
}
diff --git a/epan/epan.c b/epan/epan.c
index 2625a2eb81..d19109afe7 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -58,6 +58,7 @@
#include "export_object.h"
#include "stat_tap_ui.h"
#include "follow.h"
+#include "disabled_protos.h"
#ifdef HAVE_LUA
#include <lua.h>
@@ -213,6 +214,7 @@ epan_cleanup(void)
export_object_cleanup();
stat_tap_table_cleanup();
follow_cleanup();
+ disabled_protos_cleanup();
#ifdef HAVE_LUA
wslua_cleanup();
#endif