diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-28 16:02:45 -0700 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-07-03 23:35:14 +0000 |
commit | 126e02cd58c08aa234cd8c9e0e0739f961f462d3 (patch) | |
tree | bc095aa1d1b9e575bdcbef49bfe017e0725b64ab /epan/dissectors/packet-rlc-lte.c | |
parent | 80f7ee063d371f0de989d51d40c6b4fabfbfb430 (diff) |
Call reassembly_table_destroy and move g_hash_table_destroy
This patch moves g_hash_table_destroy calls from the init routine to
the cleanup routine. Besides that, the conditional check for the hash
table has been removed, assuming that init is always paired with a
cleanup call.
If reassembly_table_init is found, a reassembly_table_destroy call is
prepended to the cleanup function as well.
Comments have been removed from the init function as well as these did
not seem to have additional value ("destroy hash table" is clear from
the context).
The changes were automatically generated using
https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=4d11f07180d9c115eb14bd860e9a47d82d3d1dcd
Manually edited files (for assignment auditing): dvbci, ositp, sccp,
tcp.
Other files that needed special attention due to the use of
register_postseq_cleanup_routine:
- ipx: keep call, do not add another cleanup routine.
- ncp: remove empty mncp_postseq_cleanup. mncp_hash_lookup is used
even if a frame is visited before (see dissect_ncp_common), hence
the hash table cannot be destroyed here. Do it in cleanup instead.
- ndps: add cleanup routine to kill reassembly table, but do not
destroy the hash table as it is already done in ndps_postseq_cleanup.
Change-Id: I95a72b3df2978b2c13fefff6bd6821442193d0ed
Reviewed-on: https://code.wireshark.org/review/9223
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-rlc-lte.c')
-rw-r--r-- | epan/dissectors/packet-rlc-lte.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/epan/dissectors/packet-rlc-lte.c b/epan/dissectors/packet-rlc-lte.c index 69c2cc3321..e56713c85f 100644 --- a/epan/dissectors/packet-rlc-lte.c +++ b/epan/dissectors/packet-rlc-lte.c @@ -2983,32 +2983,22 @@ static void dissect_rlc_lte_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree * file is loaded or re-loaded in wireshark */ static void rlc_lte_init_protocol(void) { - /* Destroy any existing hashes. */ - if (sequence_analysis_channel_hash) { - g_hash_table_destroy(sequence_analysis_channel_hash); - } - if (sequence_analysis_report_hash) { - g_hash_table_destroy(sequence_analysis_report_hash); - } - if (repeated_nack_channel_hash) { - g_hash_table_destroy(repeated_nack_channel_hash); - } - if (repeated_nack_report_hash) { - g_hash_table_destroy(repeated_nack_report_hash); - } - if (reassembly_report_hash) { - g_hash_table_destroy(reassembly_report_hash); - } - - /* Now create them over */ sequence_analysis_channel_hash = g_hash_table_new(rlc_channel_hash_func, rlc_channel_equal); sequence_analysis_report_hash = g_hash_table_new(rlc_result_hash_func, rlc_result_hash_equal); - repeated_nack_channel_hash = g_hash_table_new(rlc_channel_hash_func, rlc_channel_equal); repeated_nack_report_hash = g_hash_table_new(rlc_result_hash_func, rlc_result_hash_equal); reassembly_report_hash = g_hash_table_new(rlc_result_hash_func, rlc_result_hash_equal); } +static void rlc_lte_cleanup_protocol(void) +{ + g_hash_table_destroy(sequence_analysis_channel_hash); + g_hash_table_destroy(sequence_analysis_report_hash); + g_hash_table_destroy(repeated_nack_channel_hash); + g_hash_table_destroy(repeated_nack_report_hash); + g_hash_table_destroy(reassembly_report_hash); +} + /* Configure number of PDCP SN bits to use for DRB channels */ void set_rlc_lte_drb_pdcp_seqnum_length(packet_info *pinfo, guint16 ueid, guint8 drbid, guint8 userplane_seqnum_length) @@ -3610,6 +3600,7 @@ void proto_register_rlc_lte(void) ue_parameters_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); register_init_routine(&rlc_lte_init_protocol); + register_cleanup_routine(&rlc_lte_cleanup_protocol); } void proto_reg_handoff_rlc_lte(void) |