diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-30 01:11:10 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-07-03 23:54:45 +0200 |
commit | 1948fe69bd7d3dba547c1708653ec4fbc08655ac (patch) | |
tree | 220139bf21a43bb8a42fdac2f2e3507f9022fcd6 /plugins/wimax/mac_hd_generic_decoder.c | |
parent | 57a150f307dbe0469ce3468ca6d4784d0e3f955c (diff) | |
download | wireshark-1948fe69bd7d3dba547c1708653ec4fbc08655ac.tar.gz |
plugins: add cleanup routinescleanup_routine
Destroy the reassembly tables on exit, fix memleak in profinet
dissector.
Change-Id: Id34dbfde42fe715513997452f87cd4fdc328e294
Diffstat (limited to 'plugins/wimax/mac_hd_generic_decoder.c')
-rw-r--r-- | plugins/wimax/mac_hd_generic_decoder.c | 20 |
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 |