aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-02-08 16:15:18 +0100
committerMichael Mann <mmann78@netscape.net>2017-02-08 20:54:49 +0000
commitedf5ae3fba16c8ed761ec5a55095e59fe96c7647 (patch)
tree96a745a5aa278a93fe8d741a0fcbd8e228e7c653 /epan/proto.c
parent2e0ea97a819148dcafece2449419756f8d7eea1f (diff)
proto: destroy list on cleanup.
Change-Id: Icc46f1078cda4597f5a70760c96b866659092006 Reviewed-on: https://code.wireshark.org/review/20022 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 2e6217b758..cb3ed93125 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -197,6 +197,8 @@ static const char *hfinfo_char_value_format(const header_field_info *hfinfo, cha
static const char *hfinfo_numeric_value_format(const header_field_info *hfinfo, char buf[32], guint32 value);
static const char *hfinfo_numeric_value_format64(const header_field_info *hfinfo, char buf[48], guint64 value);
+static void proto_cleanup_base(void);
+
static proto_item *
proto_tree_add_node(proto_tree *tree, field_info *fi);
@@ -506,7 +508,7 @@ proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_da
register_cb cb,
gpointer client_data)
{
- proto_cleanup();
+ proto_cleanup_base();
proto_names = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL);
proto_short_names = g_hash_table_new(wrs_str_hash, g_str_equal);
@@ -573,8 +575,14 @@ proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_da
tree_is_expanded = g_new0(guint32, (num_tree_types/32)+1);
}
-void
-proto_cleanup(void)
+static void
+dissector_plugin_destroy(gpointer p)
+{
+ g_free(p);
+}
+
+static void
+proto_cleanup_base(void)
{
protocol_t *protocol;
header_field_info *hfinfo;
@@ -651,6 +659,17 @@ proto_cleanup(void)
g_hash_table_destroy(prefixes);
}
+void
+proto_cleanup(void)
+{
+ proto_cleanup_base();
+
+ if (dissector_plugins) {
+ g_slist_free_full(dissector_plugins, dissector_plugin_destroy);
+ dissector_plugins = NULL;
+ }
+}
+
static gboolean
proto_tree_traverse_pre_order(proto_tree *tree, proto_tree_traverse_func func,
gpointer data)