diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ansi_map.c | 23 | ||||
-rw-r--r-- | epan/dissectors/packet-ansi_tcap.c | 26 | ||||
-rw-r--r-- | epan/dissectors/packet-camel.c | 28 | ||||
-rw-r--r-- | epan/dissectors/packet-camel.h | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-h225.c | 26 | ||||
-rw-r--r-- | epan/dissectors/packet-h245.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-idmp.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-ldap.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-lte-rrc.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-nbap.c | 27 | ||||
-rw-r--r-- | epan/dissectors/packet-pres.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-ros.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-rrc.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-rtse.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-snmp.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-t38.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-tcap.c | 18 |
17 files changed, 172 insertions, 143 deletions
diff --git a/epan/dissectors/packet-ansi_map.c b/epan/dissectors/packet-ansi_map.c index 0dfb67e371..553bfe7d7f 100644 --- a/epan/dissectors/packet-ansi_map.c +++ b/epan/dissectors/packet-ansi_map.c @@ -1177,20 +1177,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 */ @@ -15280,7 +15276,7 @@ dissect_ansi_map_QualificationRequest2Res(gboolean implicit_tag _U_, tvbuff_t *t /*--- End of included file: packet-ansi_map-fn.c ---*/ -#line 3635 "../../asn1/ansi_map/packet-ansi_map-template.c" +#line 3631 "../../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 @@ -19228,7 +19224,7 @@ void proto_register_ansi_map(void) { NULL, HFILL }}, /*--- End of included file: packet-ansi_map-hfarr.c ---*/ -#line 5390 "../../asn1/ansi_map/packet-ansi_map-template.c" +#line 5386 "../../asn1/ansi_map/packet-ansi_map-template.c" }; /* List of subtrees */ @@ -19489,7 +19485,7 @@ void proto_register_ansi_map(void) { &ett_ansi_map_ReturnData, /*--- End of included file: packet-ansi_map-ettarr.c ---*/ -#line 5423 "../../asn1/ansi_map/packet-ansi_map-template.c" +#line 5419 "../../asn1/ansi_map/packet-ansi_map-template.c" }; static ei_register_info ei[] = { @@ -19562,6 +19558,7 @@ 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); register_new_stat_tap_ui(&stat_table); } 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(<e_rrc_init_protocol); + register_cleanup_routine(<e_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) { |