summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asn1/ansi_map/packet-ansi_map-template.c17
-rw-r--r--asn1/ansi_tcap/packet-ansi_tcap-template.c19
-rw-r--r--asn1/camel/packet-camel-template.c22
-rw-r--r--asn1/camel/packet-camel-template.h6
-rw-r--r--asn1/h225/packet-h225-template.c21
-rw-r--r--asn1/h245/packet-h245-template.c8
-rw-r--r--asn1/idmp/packet-idmp-template.c5
-rw-r--r--asn1/ldap/packet-ldap-template.c4
-rw-r--r--asn1/lte-rrc/packet-lte-rrc-template.c15
-rw-r--r--asn1/nbap/packet-nbap-template.c25
-rw-r--r--asn1/pres/packet-pres-template.c11
-rw-r--r--asn1/ros/packet-ros-template.c4
-rw-r--r--asn1/rrc/packet-rrc-template.c19
-rw-r--r--asn1/rtse/packet-rtse-template.c6
-rw-r--r--asn1/snmp/packet-snmp-template.c41
-rw-r--r--asn1/t38/packet-t38-template.c6
-rw-r--r--asn1/tcap/packet-tcap-template.c14
-rw-r--r--epan/dissectors/packet-ansi_map.c23
-rw-r--r--epan/dissectors/packet-ansi_tcap.c26
-rw-r--r--epan/dissectors/packet-camel.c28
-rw-r--r--epan/dissectors/packet-camel.h6
-rw-r--r--epan/dissectors/packet-h225.c26
-rw-r--r--epan/dissectors/packet-h245.c18
-rw-r--r--epan/dissectors/packet-idmp.c9
-rw-r--r--epan/dissectors/packet-ldap.c4
-rw-r--r--epan/dissectors/packet-lte-rrc.c15
-rw-r--r--epan/dissectors/packet-nbap.c27
-rw-r--r--epan/dissectors/packet-pres.c17
-rw-r--r--epan/dissectors/packet-ros.c4
-rw-r--r--epan/dissectors/packet-rrc.c25
-rw-r--r--epan/dissectors/packet-rtse.c10
-rw-r--r--epan/dissectors/packet-snmp.c47
-rw-r--r--epan/dissectors/packet-t38.c12
-rw-r--r--epan/dissectors/packet-tcap.c18
34 files changed, 307 insertions, 251 deletions
diff --git a/asn1/ansi_map/packet-ansi_map-template.c b/asn1/ansi_map/packet-ansi_map-template.c
index 03797d8cf0..97ea5e5ef7 100644
--- a/asn1/ansi_map/packet-ansi_map-template.c
+++ b/asn1/ansi_map/packet-ansi_map-template.c
@@ -388,20 +388,16 @@ static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo
static GHashTable *TransactionId_table=NULL;
static void
-ansi_map_init_transaction_table(void){
-
- /* Destroy any existing memory chunks / hashes. */
- if (TransactionId_table){
- g_hash_table_destroy(TransactionId_table);
- }
-
+ansi_map_init(void)
+{
TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
}
static void
-ansi_map_init_protocol(void)
+ansi_map_cleanup(void)
{
- ansi_map_init_transaction_table();
+ /* Destroy any existing memory chunks / hashes. */
+ g_hash_table_destroy(TransactionId_table);
}
/* Store Invoke information needed for the corresponding reply */
@@ -5377,5 +5373,6 @@ void proto_register_ansi_map(void) {
"Type of matching invoke/response, risk of missmatch if loose matching choosen",
&ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
- register_init_routine(&ansi_map_init_protocol);
+ register_init_routine(&ansi_map_init);
+ register_cleanup_routine(&ansi_map_cleanup);
}
diff --git a/asn1/ansi_tcap/packet-ansi_tcap-template.c b/asn1/ansi_tcap/packet-ansi_tcap-template.c
index 3039d5a1ab..fd170fc82f 100644
--- a/asn1/ansi_tcap/packet-ansi_tcap-template.c
+++ b/asn1/ansi_tcap/packet-ansi_tcap-template.c
@@ -170,22 +170,16 @@ struct ansi_tcap_invokedata_t {
static GHashTable *TransactionId_table=NULL;
static void
-ansi_tcap_init_transaction_table(void){
-
- /* Destroy any existing memory chunks / hashes. */
- if (TransactionId_table){
- g_hash_table_destroy(TransactionId_table);
- TransactionId_table = NULL;
- }
-
+ansi_tcap_init(void)
+{
TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
-
}
static void
-ansi_tcap_init_protocol(void)
+ansi_tcap_cleanup(void)
{
- ansi_tcap_init_transaction_table();
+ /* Destroy any existing memory chunks / hashes. */
+ g_hash_table_destroy(TransactionId_table);
}
/* Store Invoke information needed for the corresponding reply */
@@ -533,5 +527,6 @@ proto_register_ansi_tcap(void)
"Type of matching invoke/response, risk of missmatch if loose matching choosen",
&ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE);
- register_init_routine(&ansi_tcap_init_protocol);
+ register_init_routine(&ansi_tcap_init);
+ register_cleanup_routine(&ansi_tcap_cleanup);
}
diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c
index 2c11b5a219..f0f3e93f0f 100644
--- a/asn1/camel/packet-camel-template.c
+++ b/asn1/camel/packet-camel-template.c
@@ -496,23 +496,11 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
* Routine called when the TAP is initialized.
* so hash table are (re)created
*/
-void
+static void
camelsrt_init_routine(void)
{
-
- /* free hash-table for SRT */
- if (srt_calls != NULL) {
-#ifdef DEBUG_CAMELSRT
- dbg(16,"Destroy hash ");
-#endif
- g_hash_table_destroy(srt_calls);
- }
-
/* create new hash-table for SRT */
srt_calls = g_hash_table_new(camelsrt_call_hash, camelsrt_call_equal);
-#ifdef DEBUG_CAMELSRT
- dbg(16,"Create hash ");
-#endif
/* Reset the session counter */
camelsrt_global_SessionId=1;
@@ -523,6 +511,13 @@ camelsrt_init_routine(void)
gcamel_DisplaySRT=gcamel_PersistentSRT || gcamel_HandleSRT&gcamel_StatSRT;
}
+static void
+camelsrt_cleanup_routine(void)
+{
+ /* free hash-table for SRT */
+ g_hash_table_destroy(srt_calls);
+}
+
/*
* Update a record with the data of the Request
@@ -1510,6 +1505,7 @@ void proto_register_camel(void) {
/* Routine for statistic */
register_init_routine(&camelsrt_init_routine);
+ register_cleanup_routine(&camelsrt_cleanup_routine);
camel_tap=register_tap(PSNAME);
register_srt_table(proto_camel, "CAMEL", 1, camelstat_packet, camelstat_init, NULL);
diff --git a/asn1/camel/packet-camel-template.h b/asn1/camel/packet-camel-template.h
index d8a4eef3a7..f73e0d4220 100644
--- a/asn1/camel/packet-camel-template.h
+++ b/asn1/camel/packet-camel-template.h
@@ -119,12 +119,6 @@ struct camelsrt_info_t {
};
/**
- * Routine called when the TAP is initialized.
- * so hash table are (re)created
- */
-void camelsrt_init_routine(void);
-
-/**
* Initialize the Message Info used by the main dissector
* Data are linked to a TCAP transaction
*/
diff --git a/asn1/h225/packet-h225-template.c b/asn1/h225/packet-h225-template.c
index 17732081a5..e4de6ada83 100644
--- a/asn1/h225/packet-h225-template.c
+++ b/asn1/h225/packet-h225-template.c
@@ -337,25 +337,27 @@ h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pin
is (re-)dissecting a trace file from beginning.
We need to discard and init any state we've saved */
-void
+static void
h225_init_routine(void)
{
int i;
+ /* create new hash-tables for RAS SRT */
- /* free hash-tables for RAS SRT */
for(i=0;i<7;i++) {
- if (ras_calls[i] != NULL) {
- g_hash_table_destroy(ras_calls[i]);
- ras_calls[i] = NULL;
- }
+ ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal);
}
- /* create new hash-tables for RAS SRT */
+}
+static void
+h225_cleanup_routine(void)
+{
+ int i;
+
+ /* free hash-tables for RAS SRT */
for(i=0;i<7;i++) {
- ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal);
+ g_hash_table_destroy(ras_calls[i]);
}
-
}
static int
@@ -503,6 +505,7 @@ void proto_register_h225(void) {
gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE);
register_init_routine(&h225_init_routine);
+ register_cleanup_routine(&h225_cleanup_routine);
h225_tap = register_tap("h225");
register_rtd_table(proto_h225_ras, "h225", NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL);
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));
diff --git a/asn1/idmp/packet-idmp-template.c b/asn1/idmp/packet-idmp-template.c
index f0cce14c56..705630afa3 100644
--- a/asn1/idmp/packet-idmp-template.c
+++ b/asn1/idmp/packet-idmp-template.c
@@ -249,7 +249,11 @@ static void idmp_reassemble_init (void)
{
reassembly_table_init (&idmp_reassembly_table,
&addresses_reassembly_table_functions);
+}
+static void idmp_reassemble_cleanup(void)
+{
+ reassembly_table_destroy(&idmp_reassembly_table);
saved_protocolID = NULL;
}
@@ -333,6 +337,7 @@ void proto_register_idmp(void)
new_register_dissector("idmp", dissect_idmp_tcp, proto_idmp);
register_init_routine (&idmp_reassemble_init);
+ register_cleanup_routine (&idmp_reassemble_cleanup);
/* Register our configuration options for IDMP, particularly our port */
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c
index 21bd8cfdcd..7e4b823db9 100644
--- a/asn1/ldap/packet-ldap-template.c
+++ b/asn1/ldap/packet-ldap-template.c
@@ -1894,7 +1894,7 @@ dissect_mscldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
-ldap_reinit(void)
+ldap_cleanup(void)
{
ldap_conv_info_t *ldap_info;
@@ -2297,7 +2297,7 @@ void proto_register_ldap(void) {
"Connectionless Lightweight Directory Access Protocol",
"CLDAP", "cldap");
- register_init_routine(ldap_reinit);
+ register_cleanup_routine(ldap_cleanup);
ldap_tap=register_tap("ldap");
ldap_name_dissector_table = register_dissector_table("ldap.name", "LDAP Attribute Type Dissectors", FT_STRING, BASE_NONE);
diff --git a/asn1/lte-rrc/packet-lte-rrc-template.c b/asn1/lte-rrc/packet-lte-rrc-template.c
index f9cc583e36..85307c4628 100644
--- a/asn1/lte-rrc/packet-lte-rrc-template.c
+++ b/asn1/lte-rrc/packet-lte-rrc-template.c
@@ -2709,17 +2709,17 @@ dissect_lte_rrc_Handover_Preparation_Info(tvbuff_t *tvb, packet_info *pinfo, pro
static void
lte_rrc_init_protocol(void)
{
- if (lte_rrc_etws_cmas_dcs_hash) {
- g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash);
- }
- if (lte_rrc_system_info_value_changed_hash) {
- g_hash_table_destroy(lte_rrc_system_info_value_changed_hash);
- }
-
lte_rrc_etws_cmas_dcs_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
lte_rrc_system_info_value_changed_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
}
+static void
+lte_rrc_cleanup_protocol(void)
+{
+ g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash);
+ g_hash_table_destroy(lte_rrc_system_info_value_changed_hash);
+}
+
/*--- proto_register_rrc -------------------------------------------*/
void proto_register_lte_rrc(void) {
@@ -3409,6 +3409,7 @@ void proto_register_lte_rrc(void) {
#include "packet-lte-rrc-dis-reg.c"
register_init_routine(&lte_rrc_init_protocol);
+ register_cleanup_routine(&lte_rrc_cleanup_protocol);
}
diff --git a/asn1/nbap/packet-nbap-template.c b/asn1/nbap/packet-nbap-template.c
index b6a0318cd3..8c34e80269 100644
--- a/asn1/nbap/packet-nbap-template.c
+++ b/asn1/nbap/packet-nbap-template.c
@@ -419,16 +419,9 @@ static gint nbap_key_cmp(gconstpointer a_ptr, gconstpointer b_ptr, gpointer igno
}*/
static void nbap_init(void){
- guint8 i;
- /*Cleanup*/
- if(com_context_map){
- g_tree_destroy(com_context_map);
- }
- if(edch_flow_port_map){
- g_tree_destroy(edch_flow_port_map);
- }
- /*Initialize*/
- com_context_map = g_tree_new_full(nbap_key_cmp,
+ guint8 i;
+ /*Initialize*/
+ com_context_map = g_tree_new_full(nbap_key_cmp,
NULL, /* data pointer, optional */
NULL, /* function to free the memory allocated for the key used when removing the entry */
g_free);
@@ -441,9 +434,16 @@ static void nbap_init(void){
g_free);
for (i = 0; i < 15; i++) {
- lchId_type_table[i+1] = *lch_contents[i];
- }
+ lchId_type_table[i+1] = *lch_contents[i];
+ }
}
+
+static void nbap_cleanup(void){
+ /*Cleanup*/
+ g_tree_destroy(com_context_map);
+ g_tree_destroy(edch_flow_port_map);
+}
+
static int
dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
@@ -532,6 +532,7 @@ void proto_register_nbap(void)
nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE);
register_init_routine(nbap_init);
+ register_cleanup_routine(nbap_cleanup);
}
/*
diff --git a/asn1/pres/packet-pres-template.c b/asn1/pres/packet-pres-template.c
index 02663841f9..5ec32a1fb2 100644
--- a/asn1/pres/packet-pres-template.c
+++ b/asn1/pres/packet-pres-template.c
@@ -117,16 +117,18 @@ pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
static void
pres_init(void)
{
- if( pres_ctx_oid_table ){
- g_hash_table_destroy(pres_ctx_oid_table);
- pres_ctx_oid_table = NULL;
- }
pres_ctx_oid_table = g_hash_table_new(pres_ctx_oid_hash,
pres_ctx_oid_equal);
}
static void
+pres_cleanup(void)
+{
+ g_hash_table_destroy(pres_ctx_oid_table);
+}
+
+static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
{
pres_ctx_oid_t *pco, *tmppco;
@@ -441,6 +443,7 @@ void proto_register_pres(void) {
expert_pres = expert_register_protocol(proto_pres);
expert_register_field_array(expert_pres, ei, array_length(ei));
register_init_routine(pres_init);
+ register_cleanup_routine(pres_cleanup);
pres_module = prefs_register_protocol(proto_pres, NULL);
diff --git a/asn1/ros/packet-ros-template.c b/asn1/ros/packet-ros-template.c
index b18fc5129f..49cbd9e499 100644
--- a/asn1/ros/packet-ros-template.c
+++ b/asn1/ros/packet-ros-template.c
@@ -437,7 +437,7 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
}
static void
-ros_reinit(void)
+ros_cleanup(void)
{
ros_conv_info_t *ros_info;
@@ -519,7 +519,7 @@ void proto_register_ros(void) {
ros_handle = find_dissector("ros");
- register_init_routine(ros_reinit);
+ register_cleanup_routine(ros_cleanup);
}
diff --git a/asn1/rrc/packet-rrc-template.c b/asn1/rrc/packet-rrc-template.c
index 10644788f4..86814ab98e 100644
--- a/asn1/rrc/packet-rrc-template.c
+++ b/asn1/rrc/packet-rrc-template.c
@@ -242,14 +242,8 @@ dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
-static void rrc_init(void){
- /*Cleanup*/
- if(hsdsch_muxed_flows){
- g_tree_destroy(hsdsch_muxed_flows);
- }
- if(rrc_ciph_inf){
- g_tree_destroy(rrc_ciph_inf);
- }
+static void
+rrc_init(void) {
/*Initialize structure for muxed flow indication*/
hsdsch_muxed_flows = g_tree_new_full(rrc_key_cmp,
NULL, /* data pointer, optional */
@@ -262,6 +256,14 @@ static void rrc_init(void){
NULL,
rrc_free_value);
}
+
+static void
+rrc_cleanup(void) {
+ /*Cleanup*/
+ g_tree_destroy(hsdsch_muxed_flows);
+ g_tree_destroy(rrc_ciph_inf);
+}
+
/*--- proto_register_rrc -------------------------------------------*/
void proto_register_rrc(void) {
@@ -338,6 +340,7 @@ void proto_register_rrc(void) {
register_init_routine(rrc_init);
+ register_cleanup_routine(rrc_cleanup);
}
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",
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index e5e6352465..5914dc99d3 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -1437,28 +1437,38 @@ free_ue_cache(snmp_ue_assoc_t **cache)
#define CACHE_INSERT(c,a) if (c) { snmp_ue_assoc_t* t = c; c = a; c->next = t; } else { c = a; a->next = NULL; }
static void
-renew_ue_cache(void)
+init_ue_cache(void)
{
- free_ue_cache(&localized_ues);
- free_ue_cache(&unlocalized_ues);
-
- if (num_ueas) {
- guint i;
+ guint i;
- for(i = 0; i < num_ueas; i++) {
- snmp_ue_assoc_t* a = ue_dup(&(ueas[i]));
+ for (i = 0; i < num_ueas; i++) {
+ snmp_ue_assoc_t* a = ue_dup(&(ueas[i]));
- if (a->engine.len) {
- CACHE_INSERT(localized_ues,a);
-
- } else {
- CACHE_INSERT(unlocalized_ues,a);
- }
+ if (a->engine.len) {
+ CACHE_INSERT(localized_ues,a);
+ } else {
+ CACHE_INSERT(unlocalized_ues,a);
}
+
}
}
+static void
+cleanup_ue_cache(void)
+{
+ free_ue_cache(&localized_ues);
+ free_ue_cache(&unlocalized_ues);
+}
+
+/* Called when the user applies changes to UAT preferences. */
+static void
+renew_ue_cache(void)
+{
+ cleanup_ue_cache();
+ init_ue_cache();
+}
+
static snmp_ue_assoc_t*
localize_ue( snmp_ue_assoc_t* o, const guint8* engine, guint engine_len )
@@ -2569,7 +2579,8 @@ void proto_register_snmp(void) {
value_sub_dissectors_table = register_dissector_table("snmp.variable_oid","SNMP Variable OID", FT_STRING, BASE_NONE);
- register_init_routine(renew_ue_cache);
+ register_init_routine(init_ue_cache);
+ register_cleanup_routine(cleanup_ue_cache);
register_ber_syntax_dissector("SNMP", proto_snmp, dissect_snmp_tcp);
}
diff --git a/asn1/t38/packet-t38-template.c b/asn1/t38/packet-t38-template.c
index edf59060da..88cc0992d4 100644
--- a/asn1/t38/packet-t38-template.c
+++ b/asn1/t38/packet-t38-template.c
@@ -206,6 +206,11 @@ static void t38_defragment_init(void)
&addresses_reassembly_table_functions);
}
+static void t38_defragment_cleanup(void)
+{
+ reassembly_table_destroy(&data_reassembly_table);
+}
+
/* Set up an T38 conversation */
void t38_add_address(packet_info *pinfo,
@@ -719,6 +724,7 @@ proto_register_t38(void)
/* Init reassemble tables for HDLC */
register_init_routine(t38_defragment_init);
+ register_cleanup_routine(t38_defragment_cleanup);
t38_tap = register_tap("t38");
diff --git a/asn1/tcap/packet-tcap-template.c b/asn1/tcap/packet-tcap-template.c
index b1a7dd7f80..83e5b6a991 100644
--- a/asn1/tcap/packet-tcap-template.c
+++ b/asn1/tcap/packet-tcap-template.c
@@ -2071,6 +2071,7 @@ proto_reg_handoff_tcap(void)
}
static void init_tcap(void);
+static void cleanup_tcap(void);
void
proto_register_tcap(void)
@@ -2187,7 +2188,6 @@ proto_register_tcap(void)
/* Set default SSNs */
range_convert_str(&global_ssn_range, "", MAX_SSN);
- ssn_range = range_empty();
prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
"SCCP (and SUA) SSNs to decode as TCAP",
@@ -2222,6 +2222,7 @@ proto_register_tcap(void)
tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
register_init_routine(&init_tcap);
+ register_cleanup_routine(&cleanup_tcap);
}
@@ -2242,16 +2243,17 @@ static void range_add_callback(guint32 ssn)
static void init_tcap(void)
{
- if (ssn_range) {
- range_foreach(ssn_range, range_delete_callback);
- g_free(ssn_range);
- }
-
ssn_range = range_copy(global_ssn_range);
range_foreach(ssn_range, range_add_callback);
tcapsrt_init_routine();
}
+static void cleanup_tcap(void)
+{
+ range_foreach(ssn_range, range_delete_callback);
+ g_free(ssn_range);
+}
+
static int
dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset)
{
diff --git a/epan/dissectors/packet-ansi_map.c b/epan/dissectors/packet-ansi_map.c
index f06e116f0d..9862b14e33 100644
--- a/epan/dissectors/packet-ansi_map.c
+++ b/epan/dissectors/packet-ansi_map.c
@@ -1176,20 +1176,16 @@ static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo
static GHashTable *TransactionId_table=NULL;
static void
-ansi_map_init_transaction_table(void){
-
- /* Destroy any existing memory chunks / hashes. */
- if (TransactionId_table){
- g_hash_table_destroy(TransactionId_table);
- }
-
+ansi_map_init(void)
+{
TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
}
static void
-ansi_map_init_protocol(void)
+ansi_map_cleanup(void)
{
- ansi_map_init_transaction_table();
+ /* Destroy any existing memory chunks / hashes. */
+ g_hash_table_destroy(TransactionId_table);
}
/* Store Invoke information needed for the corresponding reply */
@@ -15279,7 +15275,7 @@ dissect_ansi_map_QualificationRequest2Res(gboolean implicit_tag _U_, tvbuff_t *t
/*--- End of included file: packet-ansi_map-fn.c ---*/
-#line 3634 "../../asn1/ansi_map/packet-ansi_map-template.c"
+#line 3630 "../../asn1/ansi_map/packet-ansi_map-template.c"
/*
* 6.5.2.dk N.S0013-0 v 1.0,X.S0004-550-E v1.0 2.301
@@ -19129,7 +19125,7 @@ void proto_register_ansi_map(void) {
NULL, HFILL }},
/*--- End of included file: packet-ansi_map-hfarr.c ---*/
-#line 5291 "../../asn1/ansi_map/packet-ansi_map-template.c"
+#line 5287 "../../asn1/ansi_map/packet-ansi_map-template.c"
};
/* List of subtrees */
@@ -19390,7 +19386,7 @@ void proto_register_ansi_map(void) {
&ett_ansi_map_ReturnData,
/*--- End of included file: packet-ansi_map-ettarr.c ---*/
-#line 5324 "../../asn1/ansi_map/packet-ansi_map-template.c"
+#line 5320 "../../asn1/ansi_map/packet-ansi_map-template.c"
};
static ei_register_info ei[] = {
@@ -19447,5 +19443,6 @@ void proto_register_ansi_map(void) {
"Type of matching invoke/response, risk of missmatch if loose matching choosen",
&ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
- register_init_routine(&ansi_map_init_protocol);
+ register_init_routine(&ansi_map_init);
+ register_cleanup_routine(&ansi_map_cleanup);
}
diff --git a/epan/dissectors/packet-ansi_tcap.c b/epan/dissectors/packet-ansi_tcap.c
index 9cba17f6d8..77b642ebd4 100644
--- a/epan/dissectors/packet-ansi_tcap.c
+++ b/epan/dissectors/packet-ansi_tcap.c
@@ -261,22 +261,17 @@ struct ansi_tcap_invokedata_t {
static GHashTable *TransactionId_table=NULL;
static void
-ansi_tcap_init_transaction_table(void){
-
- /* Destroy any existing memory chunks / hashes. */
- if (TransactionId_table){
- g_hash_table_destroy(TransactionId_table);
- TransactionId_table = NULL;
- }
-
+ansi_tcap_init(void)
+{
TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
-
}
static void
-ansi_tcap_init_protocol(void)
+ansi_tcap_cleanup(void)
{
- ansi_tcap_init_transaction_table();
+ /* Destroy any existing memory chunks / hashes. */
+ g_hash_table_destroy(TransactionId_table);
+ TransactionId_table = NULL;
}
/* Store Invoke information needed for the corresponding reply */
@@ -1413,7 +1408,7 @@ dissect_ansi_tcap_PackageType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
/*--- End of included file: packet-ansi_tcap-fn.c ---*/
-#line 356 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 351 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
@@ -1757,7 +1752,7 @@ proto_register_ansi_tcap(void)
NULL, HFILL }},
/*--- End of included file: packet-ansi_tcap-hfarr.c ---*/
-#line 491 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 486 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
};
/* Setup protocol subtree array */
@@ -1795,7 +1790,7 @@ proto_register_ansi_tcap(void)
&ett_ansi_tcap_T_paramSet,
/*--- End of included file: packet-ansi_tcap-ettarr.c ---*/
-#line 502 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
+#line 497 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c"
};
static ei_register_info ei[] = {
@@ -1830,5 +1825,6 @@ proto_register_ansi_tcap(void)
"Type of matching invoke/response, risk of missmatch if loose matching choosen",
&ansi_tcap_response_matching_type, ansi_tcap_response_matching_type_values, FALSE);
- register_init_routine(&ansi_tcap_init_protocol);
+ register_init_routine(&ansi_tcap_init);
+ register_cleanup_routine(&ansi_tcap_cleanup);
}
diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c
index 80fbdcbde6..634bbc90f6 100644
--- a/epan/dissectors/packet-camel.c
+++ b/epan/dissectors/packet-camel.c
@@ -7402,23 +7402,11 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
* Routine called when the TAP is initialized.
* so hash table are (re)created
*/
-void
+static void
camelsrt_init_routine(void)
{
-
- /* free hash-table for SRT */
- if (srt_calls != NULL) {
-#ifdef DEBUG_CAMELSRT
- dbg(16,"Destroy hash ");
-#endif
- g_hash_table_destroy(srt_calls);
- }
-
/* create new hash-table for SRT */
srt_calls = g_hash_table_new(camelsrt_call_hash, camelsrt_call_equal);
-#ifdef DEBUG_CAMELSRT
- dbg(16,"Create hash ");
-#endif
/* Reset the session counter */
camelsrt_global_SessionId=1;
@@ -7429,6 +7417,13 @@ camelsrt_init_routine(void)
gcamel_DisplaySRT=gcamel_PersistentSRT || gcamel_HandleSRT&gcamel_StatSRT;
}
+static void
+camelsrt_cleanup_routine(void)
+{
+ /* free hash-table for SRT */
+ g_hash_table_destroy(srt_calls);
+}
+
/*
* Update a record with the data of the Request
@@ -8170,7 +8165,7 @@ void proto_reg_handoff_camel(void) {
/*--- End of included file: packet-camel-dis-tab.c ---*/
-#line 1260 "../../asn1/camel/packet-camel-template.c"
+#line 1255 "../../asn1/camel/packet-camel-template.c"
} else {
range_foreach(ssn_range, range_delete_callback);
g_free(ssn_range);
@@ -10284,7 +10279,7 @@ void proto_register_camel(void) {
"InvokeId_present", HFILL }},
/*--- End of included file: packet-camel-hfarr.c ---*/
-#line 1433 "../../asn1/camel/packet-camel-template.c"
+#line 1428 "../../asn1/camel/packet-camel-template.c"
};
/* List of subtrees */
@@ -10500,7 +10495,7 @@ void proto_register_camel(void) {
&ett_camel_InvokeId,
/*--- End of included file: packet-camel-ettarr.c ---*/
-#line 1450 "../../asn1/camel/packet-camel-template.c"
+#line 1445 "../../asn1/camel/packet-camel-template.c"
};
static ei_register_info ei[] = {
@@ -10564,6 +10559,7 @@ void proto_register_camel(void) {
/* Routine for statistic */
register_init_routine(&camelsrt_init_routine);
+ register_cleanup_routine(&camelsrt_cleanup_routine);
camel_tap=register_tap(PSNAME);
register_srt_table(proto_camel, "CAMEL", 1, camelstat_packet, camelstat_init, NULL);
diff --git a/epan/dissectors/packet-camel.h b/epan/dissectors/packet-camel.h
index 4cf0815532..4083bd1c5e 100644
--- a/epan/dissectors/packet-camel.h
+++ b/epan/dissectors/packet-camel.h
@@ -127,12 +127,6 @@ struct camelsrt_info_t {
};
/**
- * Routine called when the TAP is initialized.
- * so hash table are (re)created
- */
-void camelsrt_init_routine(void);
-
-/**
* Initialize the Message Info used by the main dissector
* Data are linked to a TCAP transaction
*/
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c
index 6ecd77cd25..e7e6fe4915 100644
--- a/epan/dissectors/packet-h225.c
+++ b/epan/dissectors/packet-h225.c
@@ -7720,25 +7720,28 @@ h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pin
is (re-)dissecting a trace file from beginning.
We need to discard and init any state we've saved */
-void
+static void
h225_init_routine(void)
{
int i;
+ /* create new hash-tables for RAS SRT */
- /* free hash-tables for RAS SRT */
for(i=0;i<7;i++) {
- if (ras_calls[i] != NULL) {
- g_hash_table_destroy(ras_calls[i]);
- ras_calls[i] = NULL;
- }
+ ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal);
}
- /* create new hash-tables for RAS SRT */
+}
+static void
+h225_cleanup_routine(void)
+{
+ int i;
+
+ /* free hash-tables for RAS SRT */
for(i=0;i<7;i++) {
- ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal);
+ g_hash_table_destroy(ras_calls[i]);
+ ras_calls[i] = NULL;
}
-
}
static int
@@ -10920,7 +10923,7 @@ void proto_register_h225(void) {
NULL, HFILL }},
/*--- End of included file: packet-h225-hfarr.c ---*/
-#line 456 "../../asn1/h225/packet-h225-template.c"
+#line 459 "../../asn1/h225/packet-h225-template.c"
};
/* List of subtrees */
@@ -11170,7 +11173,7 @@ void proto_register_h225(void) {
&ett_h225_T_result,
/*--- End of included file: packet-h225-ettarr.c ---*/
-#line 462 "../../asn1/h225/packet-h225-template.c"
+#line 465 "../../asn1/h225/packet-h225-template.c"
};
module_t *h225_module;
int proto_h225_ras;
@@ -11215,6 +11218,7 @@ void proto_register_h225(void) {
gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE);
register_init_routine(&h225_init_routine);
+ register_cleanup_routine(&h225_cleanup_routine);
h225_tap = register_tap("h225");
register_rtd_table(proto_h225_ras, "h225", NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL);
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c
index e2f54fc5a3..f0da8149c4 100644
--- a/epan/dissectors/packet-h245.c
+++ b/epan/dissectors/packet-h245.c
@@ -439,13 +439,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;
@@ -1938,7 +1941,7 @@ static int hf_h245_encrypted = -1; /* OCTET_STRING */
static int hf_h245_encryptedAlphanumeric = -1; /* EncryptedAlphanumeric */
/*--- End of included file: packet-h245-hf.c ---*/
-#line 404 "../../asn1/h245/packet-h245-template.c"
+#line 407 "../../asn1/h245/packet-h245-template.c"
/* Initialize the subtree pointers */
static int ett_h245 = -1;
@@ -2439,7 +2442,7 @@ static gint ett_h245_FlowControlIndication = -1;
static gint ett_h245_MobileMultilinkReconfigurationIndication = -1;
/*--- End of included file: packet-h245-ett.c ---*/
-#line 409 "../../asn1/h245/packet-h245-template.c"
+#line 412 "../../asn1/h245/packet-h245-template.c"
/* Forward declarations */
static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
@@ -14487,7 +14490,7 @@ static int dissect_OpenLogicalChannel_PDU(tvbuff_t *tvb _U_, packet_info *pinfo
/*--- End of included file: packet-h245-fn.c ---*/
-#line 418 "../../asn1/h245/packet-h245-template.c"
+#line 421 "../../asn1/h245/packet-h245-template.c"
static void
dissect_h245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
@@ -20184,7 +20187,7 @@ void proto_register_h245(void) {
NULL, HFILL }},
/*--- End of included file: packet-h245-hfarr.c ---*/
-#line 502 "../../asn1/h245/packet-h245-template.c"
+#line 505 "../../asn1/h245/packet-h245-template.c"
};
/* List of subtrees */
@@ -20687,13 +20690,14 @@ void proto_register_h245(void) {
&ett_h245_MobileMultilinkReconfigurationIndication,
/*--- End of included file: packet-h245-ettarr.c ---*/
-#line 509 "../../asn1/h245/packet-h245-template.c"
+#line 512 "../../asn1/h245/packet-h245-template.c"
};
module_t *h245_module;
/* 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));
diff --git a/epan/dissectors/packet-idmp.c b/epan/dissectors/packet-idmp.c
index cabfa62229..8f79096e68 100644
--- a/epan/dissectors/packet-idmp.c
+++ b/epan/dissectors/packet-idmp.c
@@ -735,7 +735,11 @@ static void idmp_reassemble_init (void)
{
reassembly_table_init (&idmp_reassembly_table,
&addresses_reassembly_table_functions);
+}
+static void idmp_reassemble_cleanup(void)
+{
+ reassembly_table_destroy(&idmp_reassembly_table);
saved_protocolID = NULL;
}
@@ -930,7 +934,7 @@ void proto_register_idmp(void)
NULL, HFILL }},
/*--- End of included file: packet-idmp-hfarr.c ---*/
-#line 315 "../../asn1/idmp/packet-idmp-template.c"
+#line 319 "../../asn1/idmp/packet-idmp-template.c"
};
/* List of subtrees */
@@ -953,7 +957,7 @@ void proto_register_idmp(void)
&ett_idmp_InvokeId,
/*--- End of included file: packet-idmp-ettarr.c ---*/
-#line 323 "../../asn1/idmp/packet-idmp-template.c"
+#line 327 "../../asn1/idmp/packet-idmp-template.c"
};
module_t *idmp_module;
@@ -967,6 +971,7 @@ void proto_register_idmp(void)
new_register_dissector("idmp", dissect_idmp_tcp, proto_idmp);
register_init_routine (&idmp_reassemble_init);
+ register_cleanup_routine (&idmp_reassemble_cleanup);
/* Register our configuration options for IDMP, particularly our port */
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 7366cb31d3..d415971c12 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -4813,7 +4813,7 @@ dissect_mscldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
-ldap_reinit(void)
+ldap_cleanup(void)
{
ldap_conv_info_t *ldap_info;
@@ -5845,7 +5845,7 @@ void proto_register_ldap(void) {
"Connectionless Lightweight Directory Access Protocol",
"CLDAP", "cldap");
- register_init_routine(ldap_reinit);
+ register_cleanup_routine(ldap_cleanup);
ldap_tap=register_tap("ldap");
ldap_name_dissector_table = register_dissector_table("ldap.name", "LDAP Attribute Type Dissectors", FT_STRING, BASE_NONE);
diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c
index 009c023526..2d9163c3ff 100644
--- a/epan/dissectors/packet-lte-rrc.c
+++ b/epan/dissectors/packet-lte-rrc.c
@@ -44256,17 +44256,17 @@ dissect_lte_rrc_Handover_Preparation_Info(tvbuff_t *tvb, packet_info *pinfo, pro
static void
lte_rrc_init_protocol(void)
{
- if (lte_rrc_etws_cmas_dcs_hash) {
- g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash);
- }
- if (lte_rrc_system_info_value_changed_hash) {
- g_hash_table_destroy(lte_rrc_system_info_value_changed_hash);
- }
-
lte_rrc_etws_cmas_dcs_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
lte_rrc_system_info_value_changed_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
}
+static void
+lte_rrc_cleanup_protocol(void)
+{
+ g_hash_table_destroy(lte_rrc_etws_cmas_dcs_hash);
+ g_hash_table_destroy(lte_rrc_system_info_value_changed_hash);
+}
+
/*--- proto_register_rrc -------------------------------------------*/
void proto_register_lte_rrc(void) {
@@ -57569,6 +57569,7 @@ void proto_register_lte_rrc(void) {
#line 3410 "../../asn1/lte-rrc/packet-lte-rrc-template.c"
register_init_routine(&lte_rrc_init_protocol);
+ register_cleanup_routine(&lte_rrc_cleanup_protocol);
}
diff --git a/epan/dissectors/packet-nbap.c b/epan/dissectors/packet-nbap.c
index 051e6c9250..0b9e78039d 100644
--- a/epan/dissectors/packet-nbap.c
+++ b/epan/dissectors/packet-nbap.c
@@ -55270,16 +55270,9 @@ static gint nbap_key_cmp(gconstpointer a_ptr, gconstpointer b_ptr, gpointer igno
}*/
static void nbap_init(void){
- guint8 i;
- /*Cleanup*/
- if(com_context_map){
- g_tree_destroy(com_context_map);
- }
- if(edch_flow_port_map){
- g_tree_destroy(edch_flow_port_map);
- }
- /*Initialize*/
- com_context_map = g_tree_new_full(nbap_key_cmp,
+ guint8 i;
+ /*Initialize*/
+ com_context_map = g_tree_new_full(nbap_key_cmp,
NULL, /* data pointer, optional */
NULL, /* function to free the memory allocated for the key used when removing the entry */
g_free);
@@ -55292,9 +55285,16 @@ static void nbap_init(void){
g_free);
for (i = 0; i < 15; i++) {
- lchId_type_table[i+1] = *lch_contents[i];
- }
+ lchId_type_table[i+1] = *lch_contents[i];
+ }
+}
+
+static void nbap_cleanup(void){
+ /*Cleanup*/
+ g_tree_destroy(com_context_map);
+ g_tree_destroy(edch_flow_port_map);
}
+
static int
dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
@@ -70179,6 +70179,7 @@ void proto_register_nbap(void)
nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE);
register_init_routine(nbap_init);
+ register_cleanup_routine(nbap_cleanup);
}
/*
@@ -71295,7 +71296,7 @@ proto_reg_handoff_nbap(void)
/*--- End of included file: packet-nbap-dis-tab.c ---*/
-#line 555 "../../asn1/nbap/packet-nbap-template.c"
+#line 556 "../../asn1/nbap/packet-nbap-template.c"
}
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c
index a089d0bebb..9af2549f49 100644
--- a/epan/dissectors/packet-pres.c
+++ b/epan/dissectors/packet-pres.c
@@ -249,16 +249,18 @@ pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
static void
pres_init(void)
{
- if( pres_ctx_oid_table ){
- g_hash_table_destroy(pres_ctx_oid_table);
- pres_ctx_oid_table = NULL;
- }
pres_ctx_oid_table = g_hash_table_new(pres_ctx_oid_hash,
pres_ctx_oid_equal);
}
static void
+pres_cleanup(void)
+{
+ g_hash_table_destroy(pres_ctx_oid_table);
+}
+
+static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
{
pres_ctx_oid_t *pco, *tmppco;
@@ -1358,7 +1360,7 @@ static int dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
/*--- End of included file: packet-pres-fn.c ---*/
-#line 223 "../../asn1/pres/packet-pres-template.c"
+#line 225 "../../asn1/pres/packet-pres-template.c"
/*
@@ -1842,7 +1844,7 @@ void proto_register_pres(void) {
NULL, HFILL }},
/*--- End of included file: packet-pres-hfarr.c ---*/
-#line 394 "../../asn1/pres/packet-pres-template.c"
+#line 396 "../../asn1/pres/packet-pres-template.c"
};
/* List of subtrees */
@@ -1889,7 +1891,7 @@ void proto_register_pres(void) {
&ett_pres_UD_type,
/*--- End of included file: packet-pres-ettarr.c ---*/
-#line 400 "../../asn1/pres/packet-pres-template.c"
+#line 402 "../../asn1/pres/packet-pres-template.c"
};
static ei_register_info ei[] = {
@@ -1934,6 +1936,7 @@ void proto_register_pres(void) {
expert_pres = expert_register_protocol(proto_pres);
expert_register_field_array(expert_pres, ei, array_length(ei));
register_init_routine(pres_init);
+ register_cleanup_routine(pres_cleanup);
pres_module = prefs_register_protocol(proto_pres, NULL);
diff --git a/epan/dissectors/packet-ros.c b/epan/dissectors/packet-ros.c
index 4dd23d28f1..7f0a03595a 100644
--- a/epan/dissectors/packet-ros.c
+++ b/epan/dissectors/packet-ros.c
@@ -1076,7 +1076,7 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
}
static void
-ros_reinit(void)
+ros_cleanup(void)
{
ros_conv_info_t *ros_info;
@@ -1285,7 +1285,7 @@ void proto_register_ros(void) {
ros_handle = find_dissector("ros");
- register_init_routine(ros_reinit);
+ register_cleanup_routine(ros_cleanup);
}
diff --git a/epan/dissectors/packet-rrc.c b/epan/dissectors/packet-rrc.c
index d1b51160c2..c0023e8b35 100644
--- a/epan/dissectors/packet-rrc.c
+++ b/epan/dissectors/packet-rrc.c
@@ -143866,14 +143866,8 @@ dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
-static void rrc_init(void){
- /*Cleanup*/
- if(hsdsch_muxed_flows){
- g_tree_destroy(hsdsch_muxed_flows);
- }
- if(rrc_ciph_inf){
- g_tree_destroy(rrc_ciph_inf);
- }
+static void
+rrc_init(void) {
/*Initialize structure for muxed flow indication*/
hsdsch_muxed_flows = g_tree_new_full(rrc_key_cmp,
NULL, /* data pointer, optional */
@@ -143886,6 +143880,14 @@ static void rrc_init(void){
NULL,
rrc_free_value);
}
+
+static void
+rrc_cleanup(void) {
+ /*Cleanup*/
+ g_tree_destroy(hsdsch_muxed_flows);
+ g_tree_destroy(rrc_ciph_inf);
+}
+
/*--- proto_register_rrc -------------------------------------------*/
void proto_register_rrc(void) {
@@ -182537,7 +182539,7 @@ void proto_register_rrc(void) {
NULL, HFILL }},
/*--- End of included file: packet-rrc-hfarr.c ---*/
-#line 272 "../../asn1/rrc/packet-rrc-template.c"
+#line 274 "../../asn1/rrc/packet-rrc-template.c"
{ &hf_test,
{ "RAB Test", "rrc.RAB.test",
FT_UINT8, BASE_DEC, NULL, 0,
@@ -188723,7 +188725,7 @@ void proto_register_rrc(void) {
&ett_rrc_UL_RFC3095_Context,
/*--- End of included file: packet-rrc-ettarr.c ---*/
-#line 314 "../../asn1/rrc/packet-rrc-template.c"
+#line 316 "../../asn1/rrc/packet-rrc-template.c"
&ett_rrc_eutraFeatureGroupIndicators,
&ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo,
&ett_rrc_ims_info,
@@ -188813,12 +188815,13 @@ void proto_register_rrc(void) {
/*--- End of included file: packet-rrc-dis-reg.c ---*/
-#line 336 "../../asn1/rrc/packet-rrc-template.c"
+#line 338 "../../asn1/rrc/packet-rrc-template.c"
register_init_routine(rrc_init);
+ register_cleanup_routine(rrc_cleanup);
}
diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c
index f0bf602364..f91406d4c6 100644
--- a/epan/dissectors/packet-rtse.c
+++ b/epan/dissectors/packet-rtse.c
@@ -858,6 +858,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) {
@@ -1002,7 +1007,7 @@ void proto_register_rtse(void) {
NULL, HFILL }},
/*--- End of included file: packet-rtse-hfarr.c ---*/
-#line 358 "../../asn1/rtse/packet-rtse-template.c"
+#line 363 "../../asn1/rtse/packet-rtse-template.c"
};
/* List of subtrees */
@@ -1024,7 +1029,7 @@ void proto_register_rtse(void) {
&ett_rtse_CallingSSuserReference,
/*--- End of included file: packet-rtse-ettarr.c ---*/
-#line 367 "../../asn1/rtse/packet-rtse-template.c"
+#line 372 "../../asn1/rtse/packet-rtse-template.c"
};
static ei_register_info ei[] = {
@@ -1045,6 +1050,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",
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c
index 2065b72d03..f909d62cdf 100644
--- a/epan/dissectors/packet-snmp.c
+++ b/epan/dissectors/packet-snmp.c
@@ -1539,28 +1539,38 @@ free_ue_cache(snmp_ue_assoc_t **cache)
#define CACHE_INSERT(c,a) if (c) { snmp_ue_assoc_t* t = c; c = a; c->next = t; } else { c = a; a->next = NULL; }
static void
-renew_ue_cache(void)
+init_ue_cache(void)
{
- free_ue_cache(&localized_ues);
- free_ue_cache(&unlocalized_ues);
-
- if (num_ueas) {
- guint i;
+ guint i;
- for(i = 0; i < num_ueas; i++) {
- snmp_ue_assoc_t* a = ue_dup(&(ueas[i]));
+ for (i = 0; i < num_ueas; i++) {
+ snmp_ue_assoc_t* a = ue_dup(&(ueas[i]));
- if (a->engine.len) {
- CACHE_INSERT(localized_ues,a);
-
- } else {
- CACHE_INSERT(unlocalized_ues,a);
- }
+ if (a->engine.len) {
+ CACHE_INSERT(localized_ues,a);
+ } else {
+ CACHE_INSERT(unlocalized_ues,a);
}
+
}
}
+static void
+cleanup_ue_cache(void)
+{
+ free_ue_cache(&localized_ues);
+ free_ue_cache(&unlocalized_ues);
+}
+
+/* Called when the user applies changes to UAT preferences. */
+static void
+renew_ue_cache(void)
+{
+ cleanup_ue_cache();
+ init_ue_cache();
+}
+
static snmp_ue_assoc_t*
localize_ue( snmp_ue_assoc_t* o, const guint8* engine, guint engine_len )
@@ -3077,7 +3087,7 @@ static int dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, prot
/*--- End of included file: packet-snmp-fn.c ---*/
-#line 1865 "../../asn1/snmp/packet-snmp-template.c"
+#line 1875 "../../asn1/snmp/packet-snmp-template.c"
guint
@@ -3899,7 +3909,7 @@ void proto_register_snmp(void) {
NULL, HFILL }},
/*--- End of included file: packet-snmp-hfarr.c ---*/
-#line 2422 "../../asn1/snmp/packet-snmp-template.c"
+#line 2432 "../../asn1/snmp/packet-snmp-template.c"
};
/* List of subtrees */
@@ -3939,7 +3949,7 @@ void proto_register_snmp(void) {
&ett_snmp_RReqPDU_U,
/*--- End of included file: packet-snmp-ettarr.c ---*/
-#line 2438 "../../asn1/snmp/packet-snmp-template.c"
+#line 2448 "../../asn1/snmp/packet-snmp-template.c"
};
static ei_register_info ei[] = {
{ &ei_snmp_failed_decrypted_data_pdu, { "snmp.failed_decrypted_data_pdu", PI_MALFORMED, PI_WARN, "Failed to decrypt encryptedPDU", EXPFILL }},
@@ -4074,7 +4084,8 @@ void proto_register_snmp(void) {
value_sub_dissectors_table = register_dissector_table("snmp.variable_oid","SNMP Variable OID", FT_STRING, BASE_NONE);
- register_init_routine(renew_ue_cache);
+ register_init_routine(init_ue_cache);
+ register_cleanup_routine(cleanup_ue_cache);
register_ber_syntax_dissector("SNMP", proto_snmp, dissect_snmp_tcp);
}
diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c
index 1443766802..015a7655d1 100644
--- a/epan/dissectors/packet-t38.c
+++ b/epan/dissectors/packet-t38.c
@@ -251,6 +251,11 @@ static void t38_defragment_init(void)
&addresses_reassembly_table_functions);
}
+static void t38_defragment_cleanup(void)
+{
+ reassembly_table_destroy(&data_reassembly_table);
+}
+
/* Set up an T38 conversation */
void t38_add_address(packet_info *pinfo,
@@ -977,7 +982,7 @@ static int dissect_UDPTLPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr
/*--- End of included file: packet-t38-fn.c ---*/
-#line 392 "../../asn1/t38/packet-t38-template.c"
+#line 397 "../../asn1/t38/packet-t38-template.c"
/* initialize the tap t38_info and the conversation */
static void
@@ -1316,7 +1321,7 @@ proto_register_t38(void)
"OCTET_STRING", HFILL }},
/*--- End of included file: packet-t38-hfarr.c ---*/
-#line 654 "../../asn1/t38/packet-t38-template.c"
+#line 659 "../../asn1/t38/packet-t38-template.c"
{ &hf_t38_setup,
{ "Stream setup", "t38.setup", FT_STRING, BASE_NONE,
NULL, 0x0, "Stream setup, method and frame number", HFILL }},
@@ -1377,7 +1382,7 @@ proto_register_t38(void)
&ett_t38_T_fec_data,
/*--- End of included file: packet-t38-ettarr.c ---*/
-#line 701 "../../asn1/t38/packet-t38-template.c"
+#line 706 "../../asn1/t38/packet-t38-template.c"
&ett_t38_setup,
&ett_data_fragment,
&ett_data_fragments
@@ -1399,6 +1404,7 @@ proto_register_t38(void)
/* Init reassemble tables for HDLC */
register_init_routine(t38_defragment_init);
+ register_cleanup_routine(t38_defragment_cleanup);
t38_tap = register_tap("t38");
diff --git a/epan/dissectors/packet-tcap.c b/epan/dissectors/packet-tcap.c
index 4b43feeea3..854c952782 100644
--- a/epan/dissectors/packet-tcap.c
+++ b/epan/dissectors/packet-tcap.c
@@ -3350,6 +3350,7 @@ proto_reg_handoff_tcap(void)
}
static void init_tcap(void);
+static void cleanup_tcap(void);
void
proto_register_tcap(void)
@@ -3687,7 +3688,7 @@ proto_register_tcap(void)
NULL, HFILL }},
/*--- End of included file: packet-tcap-hfarr.c ---*/
-#line 2143 "../../asn1/tcap/packet-tcap-template.c"
+#line 2144 "../../asn1/tcap/packet-tcap-template.c"
};
/* Setup protocol subtree array */
@@ -3736,7 +3737,7 @@ proto_register_tcap(void)
&ett_tcap_Associate_source_diagnostic,
/*--- End of included file: packet-tcap-ettarr.c ---*/
-#line 2153 "../../asn1/tcap/packet-tcap-template.c"
+#line 2154 "../../asn1/tcap/packet-tcap-template.c"
};
/*static enum_val_t tcap_options[] = {
@@ -3774,7 +3775,6 @@ proto_register_tcap(void)
/* Set default SSNs */
range_convert_str(&global_ssn_range, "", MAX_SSN);
- ssn_range = range_empty();
prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
"SCCP (and SUA) SSNs to decode as TCAP",
@@ -3809,6 +3809,7 @@ proto_register_tcap(void)
tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
register_init_routine(&init_tcap);
+ register_cleanup_routine(&cleanup_tcap);
}
@@ -3829,16 +3830,17 @@ static void range_add_callback(guint32 ssn)
static void init_tcap(void)
{
- if (ssn_range) {
- range_foreach(ssn_range, range_delete_callback);
- g_free(ssn_range);
- }
-
ssn_range = range_copy(global_ssn_range);
range_foreach(ssn_range, range_add_callback);
tcapsrt_init_routine();
}
+static void cleanup_tcap(void)
+{
+ range_foreach(ssn_range, range_delete_callback);
+ g_free(ssn_range);
+}
+
static int
dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset)
{