aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/h245
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-27 15:33:42 -0700
committerMichael Mann <mmann78@netscape.net>2015-07-04 00:17:14 +0000
commit3243b6f964c96f0137fc3fffd66a74dd9f7910fd (patch)
treecb4c47ada88b45cd7f6b1835cd412d1d60b746c2 /asn1/h245
parent7b33634cc562ba0ee75536b7dde4268a20d89bee (diff)
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 Reviewed-on: https://code.wireshark.org/review/9136 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'asn1/h245')
-rw-r--r--asn1/h245/packet-h245-template.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/asn1/h245/packet-h245-template.c b/asn1/h245/packet-h245-template.c
index a2bc16d616..d4d9ef2dc4 100644
--- a/asn1/h245/packet-h245-template.c
+++ b/asn1/h245/packet-h245-template.c
@@ -308,13 +308,16 @@ static void h223_lc_init( void )
static void h245_init(void)
{
- if ( h245_pending_olc_reqs)
- g_hash_table_destroy(h245_pending_olc_reqs);
h245_pending_olc_reqs = g_hash_table_new(g_str_hash, g_str_equal);
h223_lc_init();
}
+static void h245_cleanup(void)
+{
+ g_hash_table_destroy(h245_pending_olc_reqs);
+}
+
void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
{
h223_add_lc_handle = handle;
@@ -512,6 +515,7 @@ void proto_register_h245(void) {
/* Register protocol */
proto_h245 = proto_register_protocol(PNAME, PSNAME, PFNAME);
register_init_routine(h245_init);
+ register_cleanup_routine(h245_cleanup);
/* Register fields and subtrees */
proto_register_field_array(proto_h245, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));