aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-dcom.c7
-rw-r--r--epan/dissectors/packet-gtp.c4
-rw-r--r--epan/dissectors/packet-h223.c17
-rw-r--r--epan/dissectors/packet-iax2.c32
-rw-r--r--epan/dissectors/packet-l2tp.c4
-rw-r--r--epan/dissectors/packet-ntlmssp.c18
-rw-r--r--epan/dissectors/packet-sctp.c32
-rw-r--r--epan/dissectors/packet-smb.c9
-rw-r--r--epan/dissectors/packet-umts_fp.c1
-rw-r--r--epan/dissectors/packet-x11.c4
-rw-r--r--epan/dissectors/packet-zbee-nwk-gp.c14
11 files changed, 60 insertions, 82 deletions
diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c
index c0fde287e8..c63396d710 100644
--- a/epan/dissectors/packet-dcom.c
+++ b/epan/dissectors/packet-dcom.c
@@ -2172,8 +2172,7 @@ dissect_dcom_PMInterfacePointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
return offset;
}
-static void dcom_reinit( void) {
-
+static void dcom_cleanup(void) {
if (dcom_machines != NULL) {
GList *machines;
@@ -2217,8 +2216,6 @@ static void dcom_reinit( void) {
g_list_free(dcom_interfaces);
dcom_interfaces = NULL;
}
-
- return;
}
void
@@ -2505,7 +2502,7 @@ proto_register_dcom (void)
"usually hidden",
&dcom_prefs_display_unmarshalling_details);
- register_init_routine(dcom_reinit);
+ register_cleanup_routine(dcom_cleanup);
}
diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c
index 37de190955..30f478b80a 100644
--- a/epan/dissectors/packet-gtp.c
+++ b/epan/dissectors/packet-gtp.c
@@ -8609,7 +8609,7 @@ dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
}
static void
-gtp_reinit(void)
+gtp_cleanup(void)
{
gtp_conv_info_t *gtp_info;
@@ -9787,7 +9787,7 @@ proto_register_gtp(void)
gtp_priv_ext_dissector_table = register_dissector_table("gtp.priv_ext", "GTP PRIVATE EXT", FT_UINT16, BASE_DEC);
gtp_cdr_fmt_dissector_table = register_dissector_table("gtp.cdr_fmt", "GTP DATA RECORD TYPE", FT_UINT16, BASE_DEC);
- register_init_routine(gtp_reinit);
+ register_cleanup_routine(gtp_cleanup);
gtp_tap = register_tap("gtp");
gtpv1_tap = register_tap("gtpv1");
diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c
index 590b76dc6b..c45d492de6 100644
--- a/epan/dissectors/packet-h223.c
+++ b/epan/dissectors/packet-h223.c
@@ -217,12 +217,16 @@ circuit_chain_lookup(const h223_call_info* call_info, guint32 child_vc)
static void
circuit_chain_init(void)
{
- if (circuit_chain_hashtable)
- g_hash_table_destroy(circuit_chain_hashtable);
circuit_chain_hashtable = g_hash_table_new(circuit_chain_hash, circuit_chain_equal);
circuit_chain_count = 1;
}
+static void
+circuit_chain_destroy(void)
+{
+ g_hash_table_destroy(circuit_chain_hashtable);
+}
+
/***************************************************************************
*
@@ -1433,12 +1437,6 @@ dissect_h223_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/******************************************************************************/
-static void
-h223_init_protocol (void)
-{
- circuit_chain_init();
-}
-
void proto_register_h223 (void)
{
@@ -1653,7 +1651,8 @@ void proto_register_h223 (void)
/* register our init routine to be called at the start of a capture,
to clear out our hash tables etc */
- register_init_routine(&h223_init_protocol);
+ register_init_routine(&circuit_chain_init);
+ register_cleanup_routine(&circuit_chain_destroy);
h245_set_h223_set_mc_handle( &h223_set_mc );
h245_set_h223_add_lc_handle( &h223_add_lc );
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");
}
diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c
index 3ec831de67..b6b0833ced 100644
--- a/epan/dissectors/packet-l2tp.c
+++ b/epan/dissectors/packet-l2tp.c
@@ -2659,7 +2659,7 @@ static int dissect_atm_oam_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
return tvb_captured_length(tvb);
}
-static void init_l2tp_dissection(void)
+static void l2tp_cleanup(void)
{
GSList *iterator = list_heads;
@@ -3029,7 +3029,7 @@ proto_register_l2tp(void)
"Shared secret used for control message digest authentication",
&shared_secret);
- register_init_routine(init_l2tp_dissection);
+ register_cleanup_routine(l2tp_cleanup);
register_decode_as(&l2tp_da);
}
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index a066d0ca0d..73b28231c1 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -2587,21 +2587,18 @@ header_equal(gconstpointer pointer1, gconstpointer pointer2)
static void
ntlmssp_init_protocol(void)
{
- /*
- * Free the decrypted payloads, and then free the list of decrypted
- * payloads.
- */
+ hash_packet = g_hash_table_new(header_hash, header_equal);
+}
+
+static void
+ntlmssp_cleanup_protocol(void)
+{
if (decrypted_payloads != NULL) {
g_slist_foreach(decrypted_payloads, free_payload, NULL);
g_slist_free(decrypted_payloads);
decrypted_payloads = NULL;
}
-
- if (hash_packet != NULL) {
- g_hash_table_remove_all(hash_packet);
- } else {
- hash_packet = g_hash_table_new(header_hash, header_equal);
- }
+ g_hash_table_destroy(hash_packet);
}
@@ -3267,6 +3264,7 @@ proto_register_ntlmssp(void)
expert_ntlmssp = expert_register_protocol(proto_ntlmssp);
expert_register_field_array(expert_ntlmssp, ei, array_length(ei));
register_init_routine(&ntlmssp_init_protocol);
+ register_cleanup_routine(&ntlmssp_cleanup_protocol);
ntlmssp_module = prefs_register_protocol(proto_ntlmssp, NULL);
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index f7b241a890..54813dd13b 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -2630,36 +2630,19 @@ frag_free_msgs(sctp_frag_msg *msg)
g_free(msg);
}
-static gboolean
-free_table_entry(gpointer key, gpointer value, gpointer user_data _U_)
-{
- sctp_frag_msg *msg = (sctp_frag_msg *)value;
- frag_key *fkey = (frag_key *)key;
-
- frag_free_msgs(msg);
- g_free(fkey);
- return TRUE;
-}
-
static void
-frag_table_init(void)
+sctp_init(void)
{
- /* destroy an existing hash table and create a new one */
- if (frag_table) {
- g_hash_table_foreach_remove(frag_table, free_table_entry, NULL);
- g_hash_table_destroy(frag_table);
- frag_table=NULL;
- }
-
- frag_table = g_hash_table_new(frag_hash, frag_equal);
+ frag_table = g_hash_table_new_full(frag_hash, frag_equal,
+ (GDestroyNotify)g_free, (GDestroyNotify)frag_free_msgs);
+ num_assocs = 0;
+ assoc_info_list = NULL;
}
static void
-sctp_init(void)
+sctp_cleanup(void)
{
- frag_table_init();
- num_assocs = 0;
- assoc_info_list = NULL;
+ g_hash_table_destroy(frag_table);
}
@@ -4953,6 +4936,7 @@ proto_register_sctp(void)
sctp_heur_subdissector_list = register_heur_dissector_list("sctp");
register_init_routine(sctp_init);
+ register_cleanup_routine(sctp_cleanup);
dirs_by_ptvtag = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
dirs_by_ptaddr = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index ab771f1083..13a0eac90f 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -16885,13 +16885,8 @@ free_hash_tables(gpointer ctarg, gpointer user_data _U_)
}
static void
-smb_init_protocol(void)
+smb_cleanup(void)
{
- /*
- * Free the hash tables attached to the conversation table
- * structures, and then free the list of conversation table
- * data structures.
- */
if (conv_tables) {
g_slist_foreach(conv_tables, free_hash_tables, NULL);
g_slist_free(conv_tables);
@@ -20489,7 +20484,7 @@ proto_register_smb(void)
proto_do_register_windows_common(proto_smb);
- register_init_routine(&smb_init_protocol);
+ register_cleanup_routine(&smb_cleanup);
smb_module = prefs_register_protocol(proto_smb, NULL);
prefs_register_bool_preference(smb_module, "trans_reassembly",
"Reassemble SMB Transaction payload",
diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c
index 7446279f9a..5883fa5ab8 100644
--- a/epan/dissectors/packet-umts_fp.c
+++ b/epan/dissectors/packet-umts_fp.c
@@ -4492,7 +4492,6 @@ umts_fp_init_protocol(void)
{
guint32 hosta_addr[4];
guint32 hostb_addr[4];
- /*struct e_in6_addr ip6_addr;*/
address src_addr, dst_addr;
conversation_t *conversation;
umts_fp_conversation_info_t *umts_fp_conversation_info;
diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c
index ff4b4c7ebe..7710f7b720 100644
--- a/epan/dissectors/packet-x11.c
+++ b/epan/dissectors/packet-x11.c
@@ -2691,7 +2691,7 @@ static void windowAttributes(tvbuff_t *tvb, int *offsetp, proto_tree *t,
ENDBITMASK;
}
-static void x11_init_protocol(void)
+static void x11_cleanup(void)
{
x11_conv_data_t *state;
@@ -5856,7 +5856,7 @@ void proto_register_x11(void)
expert_x11 = expert_register_protocol(proto_x11);
expert_register_field_array(expert_x11, ei, array_length(ei));
- register_init_routine(x11_init_protocol);
+ register_cleanup_routine(x11_cleanup);
extension_table = g_hash_table_new(g_str_hash, g_str_equal);
error_table = g_hash_table_new(g_str_hash, g_str_equal);
diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c
index d3291333cf..b155f73715 100644
--- a/epan/dissectors/packet-zbee-nwk-gp.c
+++ b/epan/dissectors/packet-zbee-nwk-gp.c
@@ -1453,10 +1453,6 @@ gp_init_zbee_security(void)
guint i;
key_record_t key_record;
- if (zbee_gp_keyring) {
- g_slist_free(zbee_gp_keyring);
- zbee_gp_keyring = NULL;
- }
for (i = 0; gp_uat_key_records && (i < num_uat_key_records); i++) {
key_record.frame_num = 0;
key_record.label = g_strdup(gp_uat_key_records[i].label);
@@ -1465,6 +1461,15 @@ gp_init_zbee_security(void)
}
}
+static void
+gp_cleanup_zbee_security(void)
+{
+ if (zbee_gp_keyring) {
+ g_slist_free(zbee_gp_keyring);
+ zbee_gp_keyring = NULL;
+ }
+}
+
/*FUNCTION:------------------------------------------------------
* NAME
* proto_register_zbee_nwk_gp
@@ -1755,6 +1760,7 @@ proto_register_zbee_nwk_gp(void)
"Pre-configured GP Security Keys.", zbee_gp_sec_key_table_uat);
register_init_routine(gp_init_zbee_security);
+ register_cleanup_routine(gp_cleanup_zbee_security);
/* Register the Wireshark protocol. */
proto_register_field_array(proto_zbee_nwk_gp, hf, array_length(hf));