aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gsm_sms.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-28 16:02:45 -0700
committerMichael Mann <mmann78@netscape.net>2015-07-03 23:35:14 +0000
commit126e02cd58c08aa234cd8c9e0e0739f961f462d3 (patch)
treebc095aa1d1b9e575bdcbef49bfe017e0725b64ab /epan/dissectors/packet-gsm_sms.c
parent80f7ee063d371f0de989d51d40c6b4fabfbfb430 (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-gsm_sms.c')
-rw-r--r--epan/dissectors/packet-gsm_sms.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-gsm_sms.c b/epan/dissectors/packet-gsm_sms.c
index 3b0ab8541f..5c84776d31 100644
--- a/epan/dissectors/packet-gsm_sms.c
+++ b/epan/dissectors/packet-gsm_sms.c
@@ -334,12 +334,16 @@ gsm_sms_defragment_init (void)
{
reassembly_table_init(&g_sm_reassembly_table,
&addresses_reassembly_table_functions);
- if (g_sm_fragment_params_table) {
- g_hash_table_destroy(g_sm_fragment_params_table);
- }
g_sm_fragment_params_table = g_hash_table_new(g_direct_hash, g_direct_equal);
}
+static void
+gsm_sms_defragment_cleanup (void)
+{
+ reassembly_table_destroy(&g_sm_reassembly_table);
+ g_hash_table_destroy(g_sm_fragment_params_table);
+}
+
/*
* this is the GSM 03.40 definition with the bit 2
* set to 1 for uplink messages
@@ -3285,6 +3289,7 @@ proto_register_gsm_sms(void)
/* GSM SMS UD dissector initialization routines */
register_init_routine (gsm_sms_defragment_init);
+ register_cleanup_routine (gsm_sms_defragment_cleanup);
}
/*