aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-iax2.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-28 13:18:58 -0700
committerMichael Mann <mmann78@netscape.net>2015-07-03 23:37:18 +0000
commitea46cf4f73c72bf343a5d07ba33166d696a3d1f6 (patch)
tree72b7ea5bc05e06dcd526ec3b170604bffd2a62f5 /epan/dissectors/packet-iax2.c
parent7ce77c69ea4f3424616558729ec23cf3dd1de694 (diff)
Split init of misc dissectors into init/cleanup functions
Convert remaining dissectors to use cleanup routines when possible. (Single-)linked lists require NULL, so do reset their pointers to NULL. Generated with https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=69af86e6c2cf965ba3d7f9636b647b195f0b7d57 (with AUDIT = ALWAYS_EMIT_CLEANUP_CODE = True) Remaining dissectors which did not need further changes: epan/dissectors/packet-aeron.c epan/dissectors/packet-bootp.c epan/dissectors/packet-brdwlk.c epan/dissectors/packet-drda.c epan/dissectors/packet-etch.c epan/dissectors/packet-fix.c epan/dissectors/packet-fw1.c epan/dissectors/packet-lbm.c epan/dissectors/packet-ldss.c epan/dissectors/packet-simulcrypt.c epan/dissectors/packet-spdy.c epan/dissectors/packet-starteam.c epan/dissectors/packet-udp.c Change-Id: Idcacfea6a5de38d40e67db4cdcd0452ad9f9a6a9 Reviewed-on: https://code.wireshark.org/review/9228 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-iax2.c')
-rw-r--r--epan/dissectors/packet-iax2.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c
index f33f9bb7a8..36f195a875 100644
--- a/epan/dissectors/packet-iax2.c
+++ b/epan/dissectors/packet-iax2.c
@@ -736,21 +736,6 @@ typedef struct iax_call_data {
iax_call_dirdata dirdata[2];
} iax_call_data;
-static void iax_init_hash( void )
-{
- if (iax_circuit_hashtab)
- g_hash_table_destroy(iax_circuit_hashtab);
- iax_circuit_hashtab = g_hash_table_new(iax_circuit_hash, iax_circuit_equal);
- circuitcount = 0;
-
- if (iax_fid_table)
- g_hash_table_destroy(iax_fid_table);
- iax_fid_table = g_hash_table_new(g_direct_hash, g_direct_equal);
-
- reassembly_table_init(&iax_reassembly_table,
- &addresses_reassembly_table_functions);
-}
-
/* creates a new CT_IAX2 circuit with a specified circuit id for a call
@@ -2437,7 +2422,21 @@ static void dissect_payload(tvbuff_t *tvb, guint32 offset,
static void
iax_init_protocol(void)
{
- iax_init_hash();
+ iax_circuit_hashtab = g_hash_table_new(iax_circuit_hash, iax_circuit_equal);
+ circuitcount = 0;
+
+ iax_fid_table = g_hash_table_new(g_direct_hash, g_direct_equal);
+
+ reassembly_table_init(&iax_reassembly_table,
+ &addresses_reassembly_table_functions);
+}
+
+static void
+iax_cleanup_protocol(void)
+{
+ g_hash_table_destroy(iax_circuit_hashtab);
+ g_hash_table_destroy(iax_fid_table);
+ reassembly_table_destroy(&iax_reassembly_table);
}
@@ -3206,6 +3205,7 @@ proto_register_iax2(void)
/* register our init routine to be called at the start of a capture,
to clear out our hash tables etc */
register_init_routine(&iax_init_protocol);
+ register_cleanup_routine(&iax_cleanup_protocol);
iax2_tap = register_tap("IAX2");
}