aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-12-21 11:50:47 +0100
committerMichael Mann <mmann78@netscape.net>2017-01-12 12:39:15 +0000
commit805ddd1addbea96308fe3b790043ec511c73bbfa (patch)
treefbb2f6b1ee81a849e1afd5cac1f180601d9c7273
parent01c8028add4099ad8707302efd9207b82daa7f81 (diff)
uat: add a reset callback.
This function will free the resources allocated by the caller. Change-Id: Ib486c14e4fd3c321662fb71f7fd06733ce9a64a4 Reviewed-on: https://code.wireshark.org/review/19375 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dfilter/dfilter-macro.c1
-rw-r--r--epan/dissectors/asn1/c1222/packet-c1222-template.c1
-rw-r--r--epan/dissectors/asn1/ess/packet-ess-template.c1
-rw-r--r--epan/dissectors/asn1/ldap/packet-ldap-template.c1
-rw-r--r--epan/dissectors/asn1/pres/packet-pres-template.c1
-rw-r--r--epan/dissectors/asn1/snmp/packet-snmp-template.c2
-rw-r--r--epan/dissectors/packet-ber.c1
-rw-r--r--epan/dissectors/packet-bootp.c1
-rw-r--r--epan/dissectors/packet-btrfcomm.c1
-rw-r--r--epan/dissectors/packet-c1222.c1
-rw-r--r--epan/dissectors/packet-devicenet.c1
-rw-r--r--epan/dissectors/packet-dmp.c1
-rw-r--r--epan/dissectors/packet-dof.c3
-rw-r--r--epan/dissectors/packet-dtls.c8
-rw-r--r--epan/dissectors/packet-ess.c3
-rw-r--r--epan/dissectors/packet-http.c1
-rw-r--r--epan/dissectors/packet-ieee80211.c1
-rw-r--r--epan/dissectors/packet-ieee802154.c1
-rw-r--r--epan/dissectors/packet-imf.c1
-rw-r--r--epan/dissectors/packet-ipsec.c1
-rw-r--r--epan/dissectors/packet-isakmp.c2
-rw-r--r--epan/dissectors/packet-k12.c1
-rw-r--r--epan/dissectors/packet-lbmpdmtcp.c1
-rw-r--r--epan/dissectors/packet-lbmr.c1
-rw-r--r--epan/dissectors/packet-lbtrm.c1
-rw-r--r--epan/dissectors/packet-lbtru.c1
-rw-r--r--epan/dissectors/packet-lbttcp.c1
-rw-r--r--epan/dissectors/packet-ldap.c3
-rw-r--r--epan/dissectors/packet-mac-lte.c1
-rw-r--r--epan/dissectors/packet-pdcp-lte.c1
-rw-r--r--epan/dissectors/packet-pres.c1
-rw-r--r--epan/dissectors/packet-reload.c1
-rw-r--r--epan/dissectors/packet-sccp.c2
-rw-r--r--epan/dissectors/packet-sctp.c1
-rw-r--r--epan/dissectors/packet-sip.c1
-rw-r--r--epan/dissectors/packet-snmp.c2
-rw-r--r--epan/dissectors/packet-ssl.c8
-rw-r--r--epan/dissectors/packet-umts_fp.c1
-rw-r--r--epan/dissectors/packet-user_encap.c1
-rw-r--r--epan/dissectors/packet-vcdu.c1
-rw-r--r--epan/dissectors/packet-zbee-nwk-gp.c2
-rw-r--r--epan/dissectors/packet-zbee-security.c1
-rw-r--r--epan/expert.c1
-rw-r--r--epan/geoip_db.c20
-rw-r--r--epan/oids.c2
-rw-r--r--epan/prefs.c3
-rw-r--r--epan/uat-int.h13
-rw-r--r--epan/uat.c41
-rw-r--r--epan/uat.h14
-rw-r--r--plugins/stats_tree/pinfo_stats_tree.c1
-rw-r--r--ui/qt/io_graph_dialog.cpp1
51 files changed, 130 insertions, 33 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c
index 18f7b968f7..66875b54be 100644
--- a/epan/dfilter/dfilter-macro.c
+++ b/epan/dfilter/dfilter-macro.c
@@ -584,6 +584,7 @@ void dfilter_macro_init(void) {
macro_update,
macro_free,
NULL, /* Note: This is set in macros_init () */
+ NULL,
uat_fields);
fvt_cache = g_hash_table_new(g_str_hash,g_str_equal);
diff --git a/epan/dissectors/asn1/c1222/packet-c1222-template.c b/epan/dissectors/asn1/c1222/packet-c1222-template.c
index 1c8b5ae40a..7fdea6f5b1 100644
--- a/epan/dissectors/asn1/c1222/packet-c1222-template.c
+++ b/epan/dissectors/asn1/c1222/packet-c1222-template.c
@@ -1397,6 +1397,7 @@ void proto_register_c1222(void) {
c1222_uat_data_update_cb, /* update callback */
NULL, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
c1222_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(c1222_module,
diff --git a/epan/dissectors/asn1/ess/packet-ess-template.c b/epan/dissectors/asn1/ess/packet-ess-template.c
index b9c20eb7c1..6c44ca8f3b 100644
--- a/epan/dissectors/asn1/ess/packet-ess-template.c
+++ b/epan/dissectors/asn1/ess/packet-ess-template.c
@@ -176,6 +176,7 @@ void proto_register_ess(void) {
NULL,
ess_free_cb,
NULL,
+ NULL,
attributes_flds);
static module_t *ess_module;
diff --git a/epan/dissectors/asn1/ldap/packet-ldap-template.c b/epan/dissectors/asn1/ldap/packet-ldap-template.c
index b78dd6a7a0..f635be702a 100644
--- a/epan/dissectors/asn1/ldap/packet-ldap-template.c
+++ b/epan/dissectors/asn1/ldap/packet-ldap-template.c
@@ -2218,6 +2218,7 @@ void proto_register_ldap(void) {
attribute_types_update_cb,
attribute_types_free_cb,
attribute_types_initialize_cb,
+ NULL,
custom_attribute_types_uat_fields);
prefs_register_uat_preference(ldap_module, "custom_ldap_attribute_types",
diff --git a/epan/dissectors/asn1/pres/packet-pres-template.c b/epan/dissectors/asn1/pres/packet-pres-template.c
index 46273d5d21..54ac9ae26f 100644
--- a/epan/dissectors/asn1/pres/packet-pres-template.c
+++ b/epan/dissectors/asn1/pres/packet-pres-template.c
@@ -422,6 +422,7 @@ void proto_register_pres(void) {
NULL,
pres_free_cb,
NULL,
+ NULL,
users_flds);
expert_module_t* expert_pres;
diff --git a/epan/dissectors/asn1/snmp/packet-snmp-template.c b/epan/dissectors/asn1/snmp/packet-snmp-template.c
index 7e4ade2470..00ea2e2619 100644
--- a/epan/dissectors/asn1/snmp/packet-snmp-template.c
+++ b/epan/dissectors/asn1/snmp/packet-snmp-template.c
@@ -2495,6 +2495,7 @@ void proto_register_snmp(void) {
snmp_users_update_cb,
snmp_users_free_cb,
renew_ue_cache,
+ NULL,
users_fields);
static uat_field_t specific_traps_flds[] = {
@@ -2516,6 +2517,7 @@ void proto_register_snmp(void) {
NULL,
snmp_specific_trap_free_cb,
NULL,
+ NULL,
specific_traps_flds);
/* Register protocol */
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index fbc6545709..e0de3c6078 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -4522,6 +4522,7 @@ proto_register_ber(void)
NULL,
oid_free_cb,
ber_update_oids,
+ NULL,
users_flds);
proto_ber = proto_register_protocol("Basic Encoding Rules (ASN.1 X.690)", "BER", "ber");
diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c
index 6f15b7f3a8..c9b204545a 100644
--- a/epan/dissectors/packet-bootp.c
+++ b/epan/dissectors/packet-bootp.c
@@ -8705,6 +8705,7 @@ proto_register_bootp(void)
uat_bootp_record_update_cb, /* update callback */
uat_bootp_record_free_cb, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
bootp_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(bootp_module,
diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c
index 71e1a1557d..091cf9e932 100644
--- a/epan/dissectors/packet-btrfcomm.c
+++ b/epan/dissectors/packet-btrfcomm.c
@@ -1163,6 +1163,7 @@ proto_register_btrfcomm(void)
NULL,
NULL,
NULL,
+ NULL,
uat_rfcomm_channels_fields);
prefs_register_uat_preference(module, "rfcomm.channels",
diff --git a/epan/dissectors/packet-c1222.c b/epan/dissectors/packet-c1222.c
index 75d32f407b..98c8163573 100644
--- a/epan/dissectors/packet-c1222.c
+++ b/epan/dissectors/packet-c1222.c
@@ -2037,6 +2037,7 @@ void proto_register_c1222(void) {
c1222_uat_data_update_cb, /* update callback */
NULL, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
c1222_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(c1222_module,
diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c
index fac1b3fcf8..76657cbca8 100644
--- a/epan/dissectors/packet-devicenet.c
+++ b/epan/dissectors/packet-devicenet.c
@@ -1050,6 +1050,7 @@ void proto_register_devicenet(void)
uat_devicenet_record_update_cb, /* update callback */
NULL, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
devicenet_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(devicenet_module,
diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c
index fccb32083a..8413259107 100644
--- a/epan/dissectors/packet-dmp.c
+++ b/epan/dissectors/packet-dmp.c
@@ -4905,6 +4905,7 @@ void proto_register_dmp (void)
NULL,
dmp_class_free_cb,
NULL,
+ NULL,
attributes_flds);
module_t *dmp_module;
diff --git a/epan/dissectors/packet-dof.c b/epan/dissectors/packet-dof.c
index d8ac8f18cd..d2cb747442 100644
--- a/epan/dissectors/packet-dof.c
+++ b/epan/dissectors/packet-dof.c
@@ -10973,6 +10973,7 @@ static void dof_register(void)
secmode_list_update_cb,
secmode_list_free_cb,
secmode_list_post_update_cb,
+ NULL,
secmode_uat_fields
);
@@ -10988,6 +10989,7 @@ static void dof_register(void)
seckey_list_update_cb,
seckey_list_free_cb,
seckey_list_post_update_cb,
+ NULL,
seckey_uat_fields
);
@@ -11003,6 +11005,7 @@ static void dof_register(void)
identsecret_list_update_cb,
identsecret_list_free_cb,
identsecret_list_post_update_cb,
+ NULL,
identsecret_uat_fields
);
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c
index ee625903f7..bc3cb5bd29 100644
--- a/epan/dissectors/packet-dtls.c
+++ b/epan/dissectors/packet-dtls.c
@@ -276,6 +276,13 @@ dtls_parse_uat(void)
}
static void
+dtls_reset_uat(void)
+{
+ g_hash_table_destroy(dtls_key_hash);
+ dtls_key_hash = NULL;
+}
+
+static void
dtls_parse_old_keys(void)
{
gchar **old_keys, **parts, *err;
@@ -1906,6 +1913,7 @@ proto_register_dtls(void)
NULL, /* dtlsdecrypt_update_cb? */
dtlsdecrypt_free_cb,
dtls_parse_uat,
+ dtls_reset_uat,
dtlskeylist_uats_flds);
prefs_register_uat_preference(dtls_module, "cfg",
diff --git a/epan/dissectors/packet-ess.c b/epan/dissectors/packet-ess.c
index c77e4f0625..694e8d3156 100644
--- a/epan/dissectors/packet-ess.c
+++ b/epan/dissectors/packet-ess.c
@@ -1515,6 +1515,7 @@ void proto_register_ess(void) {
NULL,
ess_free_cb,
NULL,
+ NULL,
attributes_flds);
static module_t *ess_module;
@@ -1560,6 +1561,6 @@ void proto_reg_handoff_ess(void) {
/*--- End of included file: packet-ess-dis-tab.c ---*/
-#line 203 "./asn1/ess/packet-ess-template.c"
+#line 204 "./asn1/ess/packet-ess-template.c"
}
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 34d2efa1db..7118f451e4 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -3675,6 +3675,7 @@ proto_register_http(void)
header_fields_update_cb,
header_fields_free_cb,
header_fields_initialize_cb,
+ NULL,
custom_header_uat_fields
);
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index c9eeaf880b..fed32f01c7 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -27603,6 +27603,7 @@ proto_register_ieee80211(void)
uat_wep_key_record_update_cb, /* update callback */
uat_wep_key_record_free_cb, /* free callback */
init_wepkeys, /* post update callback - update the WEP/WPA keys */
+ NULL, /* reset callback */
wep_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(wlan_module,
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 3ef8189049..7cd95e0fbb 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -4225,6 +4225,7 @@ void proto_register_ieee802154(void)
addr_uat_update_cb, /* update callback */
NULL, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
addr_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(ieee802154_module, "static_addr",
"Static Addresses",
diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c
index 2b3de17644..f4b518ea38 100644
--- a/epan/dissectors/packet-imf.c
+++ b/epan/dissectors/packet-imf.c
@@ -1312,6 +1312,7 @@ proto_register_imf(void)
header_fields_update_cb,
header_fields_free_cb,
header_fields_initialize_cb,
+ NULL,
attributes_flds);
module_t *imf_module;
diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c
index 9ce911dc14..35da543de9 100644
--- a/epan/dissectors/packet-ipsec.c
+++ b/epan/dissectors/packet-ipsec.c
@@ -2463,6 +2463,7 @@ proto_register_ipsec(void)
uat_esp_sa_record_update_cb, /* update callback */
uat_esp_sa_record_free_cb, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
esp_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(esp_module,
diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c
index 38771fbe09..f238033857 100644
--- a/epan/dissectors/packet-isakmp.c
+++ b/epan/dissectors/packet-isakmp.c
@@ -7156,6 +7156,7 @@ proto_register_isakmp(void)
ikev1_uat_data_update_cb,
NULL,
NULL,
+ NULL,
ikev1_uat_flds);
prefs_register_uat_preference(isakmp_module,
@@ -7176,6 +7177,7 @@ proto_register_isakmp(void)
ikev2_uat_data_update_cb,
NULL,
NULL,
+ NULL,
ikev2_uat_flds);
prefs_register_uat_preference(isakmp_module,
diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c
index 050b369e04..17252f8d4b 100644
--- a/epan/dissectors/packet-k12.c
+++ b/epan/dissectors/packet-k12.c
@@ -492,6 +492,7 @@ proto_register_k12(void)
k12_update_cb,
k12_free_cb,
NULL,
+ NULL,
uat_k12_flds);
k12_module = prefs_register_protocol(proto_k12, NULL);
diff --git a/epan/dissectors/packet-lbmpdmtcp.c b/epan/dissectors/packet-lbmpdmtcp.c
index 5a13a49877..6b9a3dcf21 100644
--- a/epan/dissectors/packet-lbmpdmtcp.c
+++ b/epan/dissectors/packet-lbmpdmtcp.c
@@ -424,6 +424,7 @@ void proto_register_lbmpdm_tcp(void)
lbmpdm_tcp_tag_update_cb,
lbmpdm_tcp_tag_free_cb,
NULL,
+ NULL,
lbmpdm_tcp_tag_array);
prefs_register_uat_preference(lbmpdm_tcp_module,
"tnw_lbmpdm_tcp_tags",
diff --git a/epan/dissectors/packet-lbmr.c b/epan/dissectors/packet-lbmr.c
index de3e11d894..0573ef3b5b 100644
--- a/epan/dissectors/packet-lbmr.c
+++ b/epan/dissectors/packet-lbmr.c
@@ -6584,6 +6584,7 @@ void proto_register_lbmr(void)
lbmr_tag_update_cb,
lbmr_tag_free_cb,
NULL,
+ NULL,
lbmr_tag_array);
prefs_register_uat_preference(lbmr_module,
"tnw_lbmr_tags",
diff --git a/epan/dissectors/packet-lbtrm.c b/epan/dissectors/packet-lbtrm.c
index f201d8b1ec..2b331e80af 100644
--- a/epan/dissectors/packet-lbtrm.c
+++ b/epan/dissectors/packet-lbtrm.c
@@ -1847,6 +1847,7 @@ void proto_register_lbtrm(void)
lbtrm_tag_update_cb,
lbtrm_tag_free_cb,
NULL,
+ NULL,
lbtrm_tag_array);
prefs_register_uat_preference(lbtrm_module,
"tnw_lbtrm_tags",
diff --git a/epan/dissectors/packet-lbtru.c b/epan/dissectors/packet-lbtru.c
index 4adaa1cb90..4f3a27f37a 100644
--- a/epan/dissectors/packet-lbtru.c
+++ b/epan/dissectors/packet-lbtru.c
@@ -1988,6 +1988,7 @@ void proto_register_lbtru(void)
lbtru_tag_update_cb,
lbtru_tag_free_cb,
NULL,
+ NULL,
lbtru_tag_array);
prefs_register_uat_preference(lbtru_module,
"tnw_lbtru_tags",
diff --git a/epan/dissectors/packet-lbttcp.c b/epan/dissectors/packet-lbttcp.c
index a2d717c767..680fc21a0f 100644
--- a/epan/dissectors/packet-lbttcp.c
+++ b/epan/dissectors/packet-lbttcp.c
@@ -786,6 +786,7 @@ void proto_register_lbttcp(void)
lbttcp_tag_update_cb,
lbttcp_tag_free_cb,
NULL,
+ NULL,
lbttcp_tag_array);
prefs_register_uat_preference(lbttcp_module,
"tnw_lbttcp_tags",
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 71519c66b3..02256b64fb 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -5767,6 +5767,7 @@ void proto_register_ldap(void) {
attribute_types_update_cb,
attribute_types_free_cb,
attribute_types_initialize_cb,
+ NULL,
custom_attribute_types_uat_fields);
prefs_register_uat_preference(ldap_module, "custom_ldap_attribute_types",
@@ -5876,7 +5877,7 @@ proto_reg_handoff_ldap(void)
/*--- End of included file: packet-ldap-dis-tab.c ---*/
-#line 2314 "./asn1/ldap/packet-ldap-template.c"
+#line 2315 "./asn1/ldap/packet-ldap-template.c"
dissector_add_uint_range_with_preference("tcp.port", TCP_PORT_RANGE_LDAP, ldap_handle);
}
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c
index e9713f3d3b..cf374b87a7 100644
--- a/epan/dissectors/packet-mac-lte.c
+++ b/epan/dissectors/packet-mac-lte.c
@@ -9222,6 +9222,7 @@ void proto_register_mac_lte(void)
NULL,
NULL,
NULL,
+ NULL,
lcid_drb_mapping_flds );
prefs_register_uat_preference(mac_lte_module,
diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c
index f5ad91c02c..c3b6acf198 100644
--- a/epan/dissectors/packet-pdcp-lte.c
+++ b/epan/dissectors/packet-pdcp-lte.c
@@ -2939,6 +2939,7 @@ void proto_register_pdcp(void)
uat_ue_keys_record_update_cb, /* update callback */
uat_ue_keys_record_free_cb, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
ue_keys_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(pdcp_lte_module,
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c
index 8fce786f18..7fcd15060f 100644
--- a/epan/dissectors/packet-pres.c
+++ b/epan/dissectors/packet-pres.c
@@ -1915,6 +1915,7 @@ void proto_register_pres(void) {
NULL,
pres_free_cb,
NULL,
+ NULL,
users_flds);
expert_module_t* expert_pres;
diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c
index 6f7e13f943..79960d38ce 100644
--- a/epan/dissectors/packet-reload.c
+++ b/epan/dissectors/packet-reload.c
@@ -5909,6 +5909,7 @@ proto_register_reload(void)
NULL,
uat_kindid_record_free_cb,
NULL,
+ NULL,
reloadkindidlist_uats_flds);
diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c
index 4b148a729a..a2115b1cc5 100644
--- a/epan/dissectors/packet-sccp.c
+++ b/epan/dissectors/packet-sccp.c
@@ -4103,7 +4103,7 @@ proto_register_sccp(void)
&num_sccp_users, UAT_AFFECTS_DISSECTION,
"ChSccpUsers", sccp_users_copy_cb,
sccp_users_update_cb, sccp_users_free_cb,
- NULL, users_flds );
+ NULL, NULL, users_flds );
/* Register the protocol name and description */
proto_sccp = proto_register_protocol("Signalling Connection Control Part", "SCCP", "sccp");
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index e7cb2f7f26..9ccc23caf2 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -5044,6 +5044,7 @@ proto_register_sctp(void)
sctp_chunk_type_update_cb,
sctp_chunk_type_free_cb,
NULL,
+ NULL,
custom_types_uat_fields
);
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index 73fd297c8b..a7c007f918 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -6887,6 +6887,7 @@ void proto_register_sip(void)
header_fields_update_cb,
header_fields_free_cb,
header_fields_initialize_cb,
+ NULL,
sip_custom_header_uat_fields
);
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c
index 3d51523d66..1be6c4010a 100644
--- a/epan/dissectors/packet-snmp.c
+++ b/epan/dissectors/packet-snmp.c
@@ -3993,6 +3993,7 @@ void proto_register_snmp(void) {
snmp_users_update_cb,
snmp_users_free_cb,
renew_ue_cache,
+ NULL,
users_fields);
static uat_field_t specific_traps_flds[] = {
@@ -4014,6 +4015,7 @@ void proto_register_snmp(void) {
NULL,
snmp_specific_trap_free_cb,
NULL,
+ NULL,
specific_traps_flds);
/* Register protocol */
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
index 2dd098fda8..c188c5bf2e 100644
--- a/epan/dissectors/packet-ssl.c
+++ b/epan/dissectors/packet-ssl.c
@@ -429,6 +429,13 @@ ssl_parse_uat(void)
}
static void
+ssl_reset_uat(void)
+{
+ g_hash_table_destroy(ssl_key_hash);
+ ssl_key_hash = NULL;
+}
+
+static void
ssl_parse_old_keys(void)
{
gchar **old_keys, **parts, *err;
@@ -4195,6 +4202,7 @@ proto_register_ssl(void)
NULL,
ssldecrypt_free_cb,
ssl_parse_uat,
+ ssl_reset_uat,
sslkeylist_uats_flds);
prefs_register_uat_preference(ssl_module, "key_table",
diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c
index 1044d8eed4..e6e0ef995b 100644
--- a/epan/dissectors/packet-umts_fp.c
+++ b/epan/dissectors/packet-umts_fp.c
@@ -5714,6 +5714,7 @@ void proto_register_fp(void)
NULL, /* update callback */
uat_umts_fp_record_free_cb, /* free callback */
NULL, /* post update callback */
+ NULL, /* reset callback */
umts_fp_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(fp_module,
diff --git a/epan/dissectors/packet-user_encap.c b/epan/dissectors/packet-user_encap.c
index 2a0d778fa8..842d21bb31 100644
--- a/epan/dissectors/packet-user_encap.c
+++ b/epan/dissectors/packet-user_encap.c
@@ -284,6 +284,7 @@ void proto_register_user_encap(void)
NULL,
user_free_cb,
NULL,
+ NULL,
user_flds );
prefs_register_uat_preference(module,
diff --git a/epan/dissectors/packet-vcdu.c b/epan/dissectors/packet-vcdu.c
index e04eef7931..0818491a30 100644
--- a/epan/dissectors/packet-vcdu.c
+++ b/epan/dissectors/packet-vcdu.c
@@ -655,6 +655,7 @@ proto_register_vcdu(void)
vcdu_uat_data_update_cb,
NULL,
NULL,
+ NULL,
vcdu_uat_flds);
prefs_register_uat_preference(vcdu_module,
diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c
index 112ecb4c74..2099334126 100644
--- a/epan/dissectors/packet-zbee-nwk-gp.c
+++ b/epan/dissectors/packet-zbee-nwk-gp.c
@@ -1857,7 +1857,7 @@ proto_register_zbee_nwk_gp(void)
zbee_gp_sec_key_table_uat = uat_new("ZigBee GP Security Keys", sizeof(uat_key_record_t), "zigbee_gp_keys", TRUE,
&gp_uat_key_records, &num_uat_key_records, UAT_AFFECTS_DISSECTION, NULL, uat_key_record_copy_cb,
- uat_key_record_update_cb, uat_key_record_free_cb, uat_key_record_post_update_cb, key_uat_fields);
+ uat_key_record_update_cb, uat_key_record_free_cb, uat_key_record_post_update_cb, NULL, key_uat_fields);
prefs_register_uat_preference(gp_zbee_prefs, "gp_key_table", "Pre-configured GP Security Keys",
"Pre-configured GP Security Keys.", zbee_gp_sec_key_table_uat);
diff --git a/epan/dissectors/packet-zbee-security.c b/epan/dissectors/packet-zbee-security.c
index e787da4473..76bb364bc4 100644
--- a/epan/dissectors/packet-zbee-security.c
+++ b/epan/dissectors/packet-zbee-security.c
@@ -323,6 +323,7 @@ void zbee_security_register(module_t *zbee_prefs, int proto)
uat_key_record_update_cb,
uat_key_record_free_cb,
uat_key_record_post_update,
+ NULL,
key_uat_fields );
prefs_register_uat_preference(zbee_prefs,
diff --git a/epan/expert.c b/epan/expert.c
index 430fa115bb..c757634caf 100644
--- a/epan/expert.c
+++ b/epan/expert.c
@@ -250,6 +250,7 @@ expert_packet_init(void)
uat_expert_update_cb,
uat_expert_free_cb,
uat_expert_post_update_cb,
+ NULL,
custom_expert_fields);
prefs_register_uat_preference(module_expert,
diff --git a/epan/geoip_db.c b/epan/geoip_db.c
index 3be70713a2..f972ea0a4b 100644
--- a/epan/geoip_db.c
+++ b/epan/geoip_db.c
@@ -142,9 +142,7 @@ static void geoip_db_path_free_cb(void* p) {
g_free(m->path);
}
-/* called every time the user presses "Apply" or "OK in the list of
- * GeoIP directories, and also once on startup */
-static void geoip_db_post_update_cb(void) {
+static void geoip_dat_cleanup(void) {
GeoIP *gi;
guint i;
@@ -172,7 +170,17 @@ static void geoip_db_post_update_cb(void) {
}
/* finally, free the array itself */
g_array_free(geoip_dat_arr, TRUE);
+ geoip_dat_arr = NULL;
}
+}
+
+/* called every time the user presses "Apply" or "OK in the list of
+ * GeoIP directories, and also once on startup */
+static void geoip_db_post_update_cb(void) {
+ guint i;
+ GeoIP* gi;
+
+ geoip_dat_cleanup();
/* allocate the array */
geoip_dat_arr = g_array_new(FALSE, FALSE, sizeof(GeoIP *));
@@ -203,6 +211,11 @@ static void geoip_db_post_update_cb(void) {
g_array_append_val(geoip_dat_arr, gi);
}
+static void geoip_db_cleanup(void)
+{
+ geoip_dat_cleanup();
+}
+
/**
* Initialize GeoIP lookups
*/
@@ -228,6 +241,7 @@ geoip_db_pref_init(module_t *nameres)
NULL,
geoip_db_path_free_cb,
geoip_db_post_update_cb,
+ geoip_db_cleanup,
geoip_db_paths_fields);
prefs_register_uat_preference(nameres,
diff --git a/epan/oids.c b/epan/oids.c
index 23887ddb5a..a43d65d47e 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -792,6 +792,7 @@ void oid_pref_init(module_t *nameres)
NULL,
smi_mod_free_cb,
restart_needed_warning,
+ NULL,
smi_paths_fields);
prefs_register_uat_preference(nameres,
@@ -820,6 +821,7 @@ void oid_pref_init(module_t *nameres)
NULL,
smi_mod_free_cb,
restart_needed_warning,
+ NULL,
smi_fields);
prefs_register_uat_preference(nameres,
diff --git a/epan/prefs.c b/epan/prefs.c
index 060922e769..0fb1a311e2 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -306,6 +306,9 @@ prefs_cleanup(void)
* do what clean up we can.
*/
prefs_modules_foreach(free_module_prefs, NULL);
+
+ /* Clean the uats */
+ uat_cleanup();
}
/*
diff --git a/epan/uat-int.h b/epan/uat-int.h
index be8ecbc795..2624779e2a 100644
--- a/epan/uat-int.h
+++ b/epan/uat-int.h
@@ -49,11 +49,11 @@ typedef struct _fld_data_t {
} fld_data_t;
struct epan_uat {
- const char* name;
+ char* name;
size_t record_size;
- const char* filename;
+ char* filename;
gboolean from_profile;
- const char* help;
+ char* help;
guint flags;
void** user_ptr; /**< Pointer to a dissector variable where an array of valid records are stored. */
guint* nrows_p; /**< Pointer to a dissector variable where the number of valid records in user_ptr are written. */
@@ -61,6 +61,7 @@ struct epan_uat {
uat_update_cb_t update_cb;
uat_free_cb_t free_cb;
uat_post_update_cb_t post_update_cb;
+ uat_reset_cb_t reset_cb;
uat_field_t* fields;
guint ncols;
@@ -77,10 +78,6 @@ struct epan_uat {
WS_DLL_PUBLIC
gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing);
-void uat_init(void);
-
-void uat_reset(void);
-
/**
* Clones the given record and stores it internally in the UAT. If it is
* considered a valid record, then it will also be cloned and stored in the
@@ -114,8 +111,6 @@ void uat_insert_record_idx(uat_t *uat, guint rec_idx, const void *src_record);
WS_DLL_PUBLIC
void uat_remove_record_idx(uat_t *uat, guint rec_idx);
-void uat_destroy(uat_t *uat);
-
/**
* Removes and destroys all records from the UAT.
*/
diff --git a/epan/uat.c b/epan/uat.c
index b3b0f10e9a..ff8b6fb34a 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -51,10 +51,6 @@
static GPtrArray* all_uats = NULL;
-void uat_init(void) {
- all_uats = g_ptr_array_new();
-}
-
uat_t* uat_new(const char* name,
size_t size,
const char* filename,
@@ -67,6 +63,7 @@ uat_t* uat_new(const char* name,
uat_update_cb_t update_cb,
uat_free_cb_t free_cb,
uat_post_update_cb_t post_update_cb,
+ uat_reset_cb_t reset_cb,
uat_field_t* flds_array) {
/* Create new uat */
uat_t* uat = (uat_t *)g_malloc(sizeof(uat_t));
@@ -97,6 +94,7 @@ uat_t* uat_new(const char* name,
uat->update_cb = update_cb;
uat->free_cb = free_cb;
uat->post_update_cb = post_update_cb;
+ uat->reset_cb = reset_cb;
uat->fields = flds_array;
uat->user_data = g_array_new(FALSE,FALSE,(guint)uat->record_size);
uat->raw_data = g_array_new(FALSE,FALSE,(guint)uat->record_size);
@@ -106,7 +104,7 @@ uat_t* uat_new(const char* name,
uat->from_global = FALSE;
uat->rep = NULL;
uat->free_rep = NULL;
- uat->help = help;
+ uat->help = g_strdup(help);
uat->flags = flags;
for (i=0;flds_array[i].title;i++) {
@@ -390,12 +388,6 @@ gboolean uat_save(uat_t* uat, char** error) {
return TRUE;
}
-void uat_destroy(uat_t* uat) {
- /* XXX still missing a destructor */
- g_ptr_array_remove(all_uats,uat);
-
-}
-
uat_t *uat_find(gchar *name) {
guint i;
@@ -430,6 +422,10 @@ void uat_clear(uat_t* uat) {
*((uat)->user_ptr) = NULL;
*((uat)->nrows_p) = 0;
+
+ if (uat->reset_cb) {
+ uat->reset_cb();
+ }
}
void uat_unload_all(void) {
@@ -445,15 +441,27 @@ void uat_unload_all(void) {
}
}
-#if 0
-static void uat_cleanup(void) {
- while( all_uats->len ) {
- uat_destroy((uat_t*)all_uats->pdata);
+void uat_cleanup(void) {
+ guint i;
+ guint j;
+ uat_t* uat;
+
+ for (i = 0; i < all_uats->len; i++) {
+ uat = (uat_t *)g_ptr_array_index(all_uats, i);
+ uat_clear(uat);
+ g_free(uat->help);
+ g_free(uat->name);
+ g_free(uat->filename);
+ g_array_free(uat->user_data, TRUE);
+ g_array_free(uat->raw_data, TRUE);
+ g_array_free(uat->valid_data, TRUE);
+ for (j = 0; uat->fields[j].title; j++)
+ g_free(uat->fields[j].priv);
+ g_free(uat);
}
g_ptr_array_free(all_uats,TRUE);
}
-#endif
void uat_foreach_table(uat_cb_t cb,void* user_data) {
guint i;
@@ -463,7 +471,6 @@ void uat_foreach_table(uat_cb_t cb,void* user_data) {
}
-
void uat_load_all(void) {
guint i;
gchar* err;
diff --git a/epan/uat.h b/epan/uat.h
index 94581488fc..e9301a1407 100644
--- a/epan/uat.h
+++ b/epan/uat.h
@@ -109,6 +109,14 @@ typedef void* (*uat_copy_cb_t)(void *dest, const void *source, size_t len);
typedef void (*uat_free_cb_t)(void *record);
/**
+ * Reset DB
+ *
+ * Used to free resources associated with a UAT loaded from file (e.g. post_update_cb)
+ * Optional.
+ */
+typedef void (*uat_reset_cb_t)(void);
+
+/**
* Update CB
* update(record,&error)
*
@@ -283,8 +291,14 @@ uat_t* uat_new(const char* name,
uat_update_cb_t update_cb,
uat_free_cb_t free_cb,
uat_post_update_cb_t post_update_cb,
+ uat_reset_cb_t reset_cb,
uat_field_t* flds_array);
+/** Cleanup all Uats
+ *
+ */
+void uat_cleanup(void);
+
/** Populate a uat using its file.
*
* @param uat_in Pointer to a uat. Must not be NULL.
diff --git a/plugins/stats_tree/pinfo_stats_tree.c b/plugins/stats_tree/pinfo_stats_tree.c
index b8eb54b7c1..9ac702dab5 100644
--- a/plugins/stats_tree/pinfo_stats_tree.c
+++ b/plugins/stats_tree/pinfo_stats_tree.c
@@ -314,6 +314,7 @@ void register_pinfo_stat_trees(void) {
uat_plen_record_update_cb, /* update callback */
uat_plen_record_free_cb, /* free callback */
uat_plen_record_post_update_cb, /* post update callback */
+ NULL, /* reset callback */
plen_uat_flds); /* UAT field definitions */
prefs_register_uat_preference(stat_module, "packet_lengths",
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 7beba347a2..a70c358f5c 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -1161,6 +1161,7 @@ void IOGraphDialog::loadProfileGraphs()
NULL,
io_graph_free_cb,
NULL,
+ NULL,
io_graph_fields);
char* err = NULL;
if (!uat_load(iog_uat_, &err)) {