summaryrefslogtreecommitdiff
path: root/asn1/rtse/packet-rtse-template.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-27 15:33:42 -0700
committerPeter Wu <peter@lekensteyn.nl>2015-07-03 23:54:42 +0200
commitef0006ddf357b29c1c0d5dab3948172aabd0209f (patch)
tree4ffb29efb05681082b4e6310ca7f17554ed136d3 /asn1/rtse/packet-rtse-template.c
parente4490426d7ea252561d96e43f7ed2e164879e562 (diff)
downloadwireshark-ef0006ddf357b29c1c0d5dab3948172aabd0209f.tar.gz
asn1: split off cleanup routines
General approach: 1. Split allocation (e.g. g_hash_table_new) from deallocation (g_hash_table_destroy) into functions named "init" and "cleanup". 2. Remove guards that test whether the hash tables are set as init is always called before cleanup. 3. Remove setting hash tables to NULL after destruction. 4. Copy register_init_routine function call and change init to cleanup. 5. Add cleanup function that calls reassembly_table_destroy if there is a reassembly_table_init function. Some templates were modified as follows: - snmp: split renew into init+cleanup, but keep renew for the uat_new callback. - ldap,ros: Rename init to cleanup as there was no initialization. - camel: remove init function from header, make it static. Remove debug print. - tcap: remove unused ssn_range assignment. Files in epan/ were regenerated using cmake && make asn1 Change-Id: Idac16ebf0ec304e0c8becaab5d32904e56eb69b9
Diffstat (limited to 'asn1/rtse/packet-rtse-template.c')
-rw-r--r--asn1/rtse/packet-rtse-template.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/asn1/rtse/packet-rtse-template.c b/asn1/rtse/packet-rtse-template.c
index 8221459f17..b263d21294 100644
--- a/asn1/rtse/packet-rtse-template.c
+++ b/asn1/rtse/packet-rtse-template.c
@@ -311,6 +311,11 @@ static void rtse_reassemble_init (void)
&addresses_reassembly_table_functions);
}
+static void rtse_reassemble_cleanup(void)
+{
+ reassembly_table_destroy(&rtse_reassembly_table);
+}
+
/*--- proto_register_rtse -------------------------------------------*/
void proto_register_rtse(void) {
@@ -384,6 +389,7 @@ void proto_register_rtse(void) {
expert_rtse = expert_register_protocol(proto_rtse);
expert_register_field_array(expert_rtse, ei, array_length(ei));
register_init_routine (&rtse_reassemble_init);
+ register_cleanup_routine (&rtse_reassemble_cleanup);
rtse_module = prefs_register_protocol_subtree("OSI", proto_rtse, NULL);
prefs_register_bool_preference(rtse_module, "reassemble",