summaryrefslogtreecommitdiff
path: root/plugins/wimax
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-30 01:11:10 +0200
committerMichael Mann <mmann78@netscape.net>2015-07-03 23:38:46 +0000
commit7b33634cc562ba0ee75536b7dde4268a20d89bee (patch)
treeb6f3fc598b7ebad68dddb118651148cca7ed11f4 /plugins/wimax
parent3ad976896a983178fc42a0794f137983f528cde7 (diff)
downloadwireshark-7b33634cc562ba0ee75536b7dde4268a20d89bee.tar.gz
plugins: add cleanup routines
Destroy the reassembly tables on exit, fix memleak in profinet dissector. Change-Id: Id34dbfde42fe715513997452f87cd4fdc328e294 Reviewed-on: https://code.wireshark.org/review/9229 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins/wimax')
-rw-r--r--plugins/wimax/mac_hd_generic_decoder.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c
index e919e052a5..ae0cdbba77 100644
--- a/plugins/wimax/mac_hd_generic_decoder.c
+++ b/plugins/wimax/mac_hd_generic_decoder.c
@@ -610,16 +610,6 @@ static void wimax_defragment_init(void)
cid_vernier[i] = 0;
}
cid_adj_array_size = 0;
- /* Free the array memory. */
- if (cid_adj_array) {
- g_free(cid_adj_array);
- }
- cid_adj_array = NULL;
- if (frag_num_array) {
- g_free(frag_num_array);
- }
- frag_num_array = NULL;
-
/* Initialize to make sure bs_address gets set in FCH decoder. */
bs_address.len = 0;
@@ -632,6 +622,15 @@ static void wimax_defragment_init(void)
init_wimax_globals();
}
+static void wimax_defragment_cleanup(void)
+{
+ reassembly_table_destroy(&payload_reassembly_table);
+ g_free(cid_adj_array);
+ cid_adj_array = NULL;
+ g_free(frag_num_array);
+ frag_num_array = NULL;
+}
+
static guint decode_packing_subheader(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree, guint payload_length _U_, guint payload_offset, proto_item *parent_item)
{
proto_item *generic_item = NULL;
@@ -2271,6 +2270,7 @@ void proto_register_mac_header_generic(void)
/* Register the payload fragment table init routine */
register_init_routine(wimax_defragment_init);
+ register_cleanup_routine(wimax_defragment_cleanup);
}
void