From 4962ea601f6ee08a4f774750dc37bac2fd92c2ca Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Wed, 15 Jun 2016 00:47:44 +0200 Subject: [PATCH] qt: move free_stat_tables from SimpleStatisticsDialog::fillTree to ~SimpleStatisticsDialog. Add a reference count to stat_tap_table_ui to prevent bad deallocations. Bug: 12437 Change-Id: Ib9b1f929d08a574c306dc755ec416ab94a3fd6d3 Reviewed-on: https://code.wireshark.org/review/15920 Reviewed-by: Peter Wu Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- .../asn1/ansi_map/packet-ansi_map-template.c | 3 +- .../asn1/camel/packet-camel-template.c | 3 +- .../asn1/gsm_map/packet-gsm_map-template.c | 3 +- .../asn1/h225/packet-h225-template.c | 3 +- epan/dissectors/packet-ansi_a.c | 6 ++- epan/dissectors/packet-ansi_map.c | 3 +- epan/dissectors/packet-bootp.c | 3 +- epan/dissectors/packet-camel.c | 3 +- epan/dissectors/packet-gsm_a_common.c | 30 ++++++++----- epan/dissectors/packet-gsm_map.c | 5 ++- epan/dissectors/packet-h225.c | 45 ++++++++++--------- epan/dissectors/packet-mtp3.c | 3 +- epan/dissectors/packet-rpc.c | 3 +- epan/dissectors/packet-sip.c | 3 +- epan/dissectors/packet-wsp.c | 3 +- epan/stat_tap_ui.h | 1 + ui/qt/simple_statistics_dialog.cpp | 11 ++++- ui/qt/simple_statistics_dialog.h | 2 + 18 files changed, 85 insertions(+), 48 deletions(-) diff --git a/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c b/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c index 265191922b..4573fd4eb8 100644 --- a/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c +++ b/epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c @@ -5449,7 +5449,8 @@ void proto_register_ansi_map(void) { NULL, sizeof(stat_fields)/sizeof(stat_tap_table_item), stat_fields, 0, NULL, - NULL + NULL, + 0 }; /* Register protocol */ diff --git a/epan/dissectors/asn1/camel/packet-camel-template.c b/epan/dissectors/asn1/camel/packet-camel-template.c index c0674164bc..9c4e4cd3e0 100644 --- a/epan/dissectors/asn1/camel/packet-camel-template.c +++ b/epan/dissectors/asn1/camel/packet-camel-template.c @@ -1544,7 +1544,8 @@ void proto_register_camel(void) { NULL, sizeof(camel_stat_fields)/sizeof(stat_tap_table_item), camel_stat_fields, sizeof(camel_stat_params)/sizeof(tap_param), camel_stat_params, - NULL + NULL, + 0 }; /* Register protocol */ diff --git a/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c b/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c index 797f4d50d5..e36db21b2e 100644 --- a/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c +++ b/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c @@ -3120,7 +3120,8 @@ void proto_register_gsm_map(void) { NULL, sizeof(gsm_map_stat_fields)/sizeof(stat_tap_table_item), gsm_map_stat_fields, sizeof(gsm_map_stat_params)/sizeof(tap_param), gsm_map_stat_params, - NULL + NULL, + 0 }; /* Register protocol */ diff --git a/epan/dissectors/asn1/h225/packet-h225-template.c b/epan/dissectors/asn1/h225/packet-h225-template.c index 8e80d8f297..35924cbc59 100644 --- a/epan/dissectors/asn1/h225/packet-h225-template.c +++ b/epan/dissectors/asn1/h225/packet-h225-template.c @@ -862,7 +862,8 @@ void proto_register_h225(void) { NULL, sizeof(h225_stat_fields)/sizeof(stat_tap_table_item), h225_stat_fields, sizeof(h225_stat_params)/sizeof(tap_param), h225_stat_params, - NULL + NULL, + 0 }; module_t *h225_module; diff --git a/epan/dissectors/packet-ansi_a.c b/epan/dissectors/packet-ansi_a.c index 59079c73a1..5161e5cb33 100644 --- a/epan/dissectors/packet-ansi_a.c +++ b/epan/dissectors/packet-ansi_a.c @@ -12763,7 +12763,8 @@ proto_register_ansi_a(void) NULL, sizeof(dtap_stat_fields)/sizeof(stat_tap_table_item), dtap_stat_fields, 0, NULL, - NULL + NULL, + 0 }; static stat_tap_table_ui bsmap_stat_table = { @@ -12778,7 +12779,8 @@ proto_register_ansi_a(void) NULL, sizeof(bsmap_stat_fields)/sizeof(stat_tap_table_item), bsmap_stat_fields, 0, NULL, - NULL + NULL, + 0 }; memset((void *) ett_dtap_msg, -1, sizeof(ett_dtap_msg)); diff --git a/epan/dissectors/packet-ansi_map.c b/epan/dissectors/packet-ansi_map.c index df9736a472..793389b34b 100644 --- a/epan/dissectors/packet-ansi_map.c +++ b/epan/dissectors/packet-ansi_map.c @@ -19519,7 +19519,8 @@ void proto_register_ansi_map(void) { NULL, sizeof(stat_fields)/sizeof(stat_tap_table_item), stat_fields, 0, NULL, - NULL + NULL, + 0 }; /* Register protocol */ diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index fcda233520..85d524cc7a 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -8553,7 +8553,8 @@ proto_register_bootp(void) NULL, sizeof(bootp_stat_fields)/sizeof(stat_tap_table_item), bootp_stat_fields, sizeof(bootp_stat_params)/sizeof(tap_param), bootp_stat_params, - NULL + NULL, + 0 }; module_t *bootp_module; diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c index 0b80f9d13d..c598b644ca 100644 --- a/epan/dissectors/packet-camel.c +++ b/epan/dissectors/packet-camel.c @@ -10663,7 +10663,8 @@ void proto_register_camel(void) { NULL, sizeof(camel_stat_fields)/sizeof(stat_tap_table_item), camel_stat_fields, sizeof(camel_stat_params)/sizeof(tap_param), camel_stat_params, - NULL + NULL, + 0 }; /* Register protocol */ diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index c878a7c97e..f64ab9ff1d 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -4680,7 +4680,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_mm_stat_table = { @@ -4695,7 +4696,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_rr_stat_table = { @@ -4710,7 +4712,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_cc_stat_table = { @@ -4725,7 +4728,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_gmm_stat_table = { @@ -4740,7 +4744,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_sm_stat_table = { @@ -4755,7 +4760,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_sms_stat_table = { @@ -4770,7 +4776,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_tp_stat_table = { @@ -4785,7 +4792,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_dtap_ss_stat_table = { @@ -4800,7 +4808,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; static stat_tap_table_ui gsm_a_sacch_rr_stat_table = { @@ -4815,7 +4824,8 @@ proto_register_gsm_a_common(void) NULL, sizeof(gsm_a_stat_fields)/sizeof(stat_tap_table_item), gsm_a_stat_fields, sizeof(gsm_a_stat_params)/sizeof(tap_param), gsm_a_stat_params, - NULL + NULL, + 0 }; last_offset = NUM_INDIVIDUAL_ELEMS; diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c index c9a892bccc..1dd367d364 100644 --- a/epan/dissectors/packet-gsm_map.c +++ b/epan/dissectors/packet-gsm_map.c @@ -31113,7 +31113,8 @@ void proto_register_gsm_map(void) { NULL, sizeof(gsm_map_stat_fields)/sizeof(stat_tap_table_item), gsm_map_stat_fields, sizeof(gsm_map_stat_params)/sizeof(tap_param), gsm_map_stat_params, - NULL + NULL, + 0 }; /* Register protocol */ @@ -31221,7 +31222,7 @@ void proto_register_gsm_map(void) { /*--- End of included file: packet-gsm_map-dis-tab.c ---*/ -#line 3148 "./asn1/gsm_map/packet-gsm_map-template.c" +#line 3149 "./asn1/gsm_map/packet-gsm_map-template.c" oid_add_from_string("ericsson-gsm-Map-Ext","1.2.826.0.1249.58.1.0" ); oid_add_from_string("accessTypeNotAllowed-id","1.3.12.2.1107.3.66.1.2"); /*oid_add_from_string("map-ac networkLocUp(1) version3(3)","0.4.0.0.1.0.1.3" ); diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c index 467d220f5b..beb3e7ea21 100644 --- a/epan/dissectors/packet-h225.c +++ b/epan/dissectors/packet-h225.c @@ -1565,7 +1565,7 @@ static const per_sequence_t H221NonStandard_sequence[] = { static int dissect_h225_H221NonStandard(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 792 "./asn1/h225/h225.cnf" +#line 790 "./asn1/h225/h225.cnf" t35CountryCode = 0; t35Extension = 0; manufacturerCode = 0; @@ -1573,7 +1573,7 @@ dissect_h225_H221NonStandard(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h225_H221NonStandard, H221NonStandard_sequence); -#line 796 "./asn1/h225/h225.cnf" +#line 794 "./asn1/h225/h225.cnf" h221NonStandard = ((t35CountryCode * 256) + t35Extension) * 65536 + manufacturerCode; proto_tree_add_uint(tree, hf_h221Manufacturer, tvb, (offset>>3)-4, 4, h221NonStandard); @@ -1595,7 +1595,7 @@ static const per_choice_t NonStandardIdentifier_choice[] = { static int dissect_h225_NonStandardIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 773 "./asn1/h225/h225.cnf" +#line 771 "./asn1/h225/h225.cnf" gint32 value; nsiOID = ""; @@ -1624,7 +1624,7 @@ dissect_h225_NonStandardIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t static int dissect_h225_T_nsp_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 807 "./asn1/h225/h225.cnf" +#line 805 "./asn1/h225/h225.cnf" tvbuff_t *next_tvb = NULL; offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, @@ -1647,7 +1647,7 @@ static const per_sequence_t NonStandardParameter_sequence[] = { int dissect_h225_NonStandardParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 805 "./asn1/h225/h225.cnf" +#line 803 "./asn1/h225/h225.cnf" nsp_handle = NULL; offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, @@ -2046,7 +2046,7 @@ dissect_h225_PartyNumber(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int dissect_h225_TBCD_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 902 "./asn1/h225/h225.cnf" +#line 900 "./asn1/h225/h225.cnf" int min_len, max_len; gboolean has_extension; @@ -2845,13 +2845,13 @@ static const per_sequence_t TunnelledProtocol_sequence[] = { int dissect_h225_TunnelledProtocol(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 750 "./asn1/h225/h225.cnf" +#line 748 "./asn1/h225/h225.cnf" tpOID = ""; offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h225_TunnelledProtocol, TunnelledProtocol_sequence); -#line 752 "./asn1/h225/h225.cnf" +#line 750 "./asn1/h225/h225.cnf" tp_handle = dissector_get_string_handle(tp_dissector_table, tpOID); return offset; @@ -3835,7 +3835,7 @@ dissect_h225_CircuitIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac static int dissect_h225_T_standard(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 864 "./asn1/h225/h225.cnf" +#line 862 "./asn1/h225/h225.cnf" guint32 value_int = (guint32)-1; gef_ctx_t *gefx; @@ -3853,7 +3853,7 @@ dissect_h225_T_standard(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_h225_T_oid(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 873 "./asn1/h225/h225.cnf" +#line 871 "./asn1/h225/h225.cnf" const gchar *oid_str = NULL; gef_ctx_t *gefx; @@ -3883,7 +3883,7 @@ static const per_choice_t GenericIdentifier_choice[] = { int dissect_h225_GenericIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 850 "./asn1/h225/h225.cnf" +#line 848 "./asn1/h225/h225.cnf" gef_ctx_t *gefx; proto_item* ti; @@ -3891,7 +3891,7 @@ dissect_h225_GenericIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac ett_h225_GenericIdentifier, GenericIdentifier_choice, NULL); -#line 853 "./asn1/h225/h225.cnf" +#line 851 "./asn1/h225/h225.cnf" gef_ctx_update_key(gef_ctx_get(actx->private_data)); gefx = gef_ctx_get(actx->private_data); if (gefx) { @@ -3908,7 +3908,7 @@ dissect_h225_GenericIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac static int dissect_h225_T_raw(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 883 "./asn1/h225/h225.cnf" +#line 881 "./asn1/h225/h225.cnf" tvbuff_t *value_tvb; gef_ctx_t *gefx; proto_item* ti; @@ -4026,7 +4026,7 @@ static const per_sequence_t EnumeratedParameter_sequence[] = { static int dissect_h225_EnumeratedParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 832 "./asn1/h225/h225.cnf" +#line 830 "./asn1/h225/h225.cnf" gef_ctx_t *parent_gefx; parent_gefx = gef_ctx_get(actx->private_data); @@ -4035,7 +4035,7 @@ dissect_h225_EnumeratedParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t * offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h225_EnumeratedParameter, EnumeratedParameter_sequence); -#line 837 "./asn1/h225/h225.cnf" +#line 835 "./asn1/h225/h225.cnf" actx->private_data = parent_gefx; return offset; @@ -4050,7 +4050,7 @@ static const per_sequence_t GenericData_sequence[] = { int dissect_h225_GenericData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 818 "./asn1/h225/h225.cnf" +#line 816 "./asn1/h225/h225.cnf" void *priv_data = actx->private_data; gef_ctx_t *gefx; @@ -4064,7 +4064,7 @@ dissect_h225_GenericData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_h225_GenericData, GenericData_sequence); -#line 828 "./asn1/h225/h225.cnf" +#line 826 "./asn1/h225/h225.cnf" actx->private_data = priv_data; return offset; @@ -4103,13 +4103,13 @@ dissect_h225_CircuitInfo(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int dissect_h225_FeatureDescriptor(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 842 "./asn1/h225/h225.cnf" +#line 840 "./asn1/h225/h225.cnf" void *priv_data = actx->private_data; actx->private_data = gef_ctx_alloc(NULL, "FeatureDescriptor"); offset = dissect_h225_GenericData(tvb, offset, actx, tree, hf_index); -#line 845 "./asn1/h225/h225.cnf" +#line 843 "./asn1/h225/h225.cnf" actx->private_data = priv_data; return offset; @@ -5105,7 +5105,7 @@ dissect_h225_CallLinkage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int dissect_h225_T_messageContent_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 760 "./asn1/h225/h225.cnf" +#line 758 "./asn1/h225/h225.cnf" tvbuff_t *next_tvb = NULL; offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, @@ -5141,7 +5141,7 @@ static const per_sequence_t T_tunnelledSignallingMessage_sequence[] = { static int dissect_h225_T_tunnelledSignallingMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 758 "./asn1/h225/h225.cnf" +#line 756 "./asn1/h225/h225.cnf" tp_handle = NULL; offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, @@ -11762,7 +11762,8 @@ void proto_register_h225(void) { NULL, sizeof(h225_stat_fields)/sizeof(stat_tap_table_item), h225_stat_fields, sizeof(h225_stat_params)/sizeof(tap_param), h225_stat_params, - NULL + NULL, + 0 }; module_t *h225_module; diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index 64b7f89a0d..078f764fe7 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -1060,7 +1060,8 @@ proto_register_mtp3(void) NULL, sizeof(mtp3_stat_fields)/sizeof(stat_tap_table_item), mtp3_stat_fields, sizeof(mtp3_stat_params)/sizeof(tap_param), mtp3_stat_params, - NULL + NULL, + 0 }; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index 5dc7168844..9984d41b8d 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -4354,7 +4354,8 @@ proto_register_rpc(void) NULL, sizeof(rpc_prog_stat_fields)/sizeof(stat_tap_table_item), rpc_prog_stat_fields, sizeof(rpc_prog_stat_params)/sizeof(tap_param), rpc_prog_stat_params, - NULL + NULL, + 0 }; proto_rpc = proto_register_protocol("Remote Procedure Call", "RPC", "rpc"); diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 0e27e8acf2..8e4591e7c0 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -6573,7 +6573,8 @@ void proto_register_sip(void) NULL, sizeof(sip_stat_fields)/sizeof(stat_tap_table_item), sip_stat_fields, sizeof(sip_stat_params)/sizeof(tap_param), sip_stat_params, - NULL + NULL, + 0 }; /* UAT for header fields */ diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index e862407ed9..32f6171b44 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -7335,7 +7335,8 @@ proto_register_sir(void) NULL, sizeof(wsp_stat_fields)/sizeof(stat_tap_table_item), wsp_stat_fields, sizeof(wsp_stat_params)/sizeof(tap_param), wsp_stat_params, - NULL + NULL, + 0 }; diff --git a/epan/stat_tap_ui.h b/epan/stat_tap_ui.h index 715da52999..46d6813753 100644 --- a/epan/stat_tap_ui.h +++ b/epan/stat_tap_ui.h @@ -149,6 +149,7 @@ typedef struct _stat_tap_table_ui { size_t nparams; /* number of parameters */ tap_param *params; /* pointer to table of parameter info */ GArray *tables; /* An array of stat_tap_table* */ + guint refcount; /* a reference count for deallocation */ } stat_tap_table_ui; diff --git a/ui/qt/simple_statistics_dialog.cpp b/ui/qt/simple_statistics_dialog.cpp index 7e460868a5..2360330622 100644 --- a/ui/qt/simple_statistics_dialog.cpp +++ b/ui/qt/simple_statistics_dialog.cpp @@ -158,6 +158,7 @@ SimpleStatisticsDialog::SimpleStatisticsDialog(QWidget &parent, CaptureFile &cf, TapParameterDialog(parent, cf, help_topic), stu_(stu) { + stu->refcount++; setWindowSubtitle(stu_->title); loadGeometry(0, 0, stu_->title); @@ -285,7 +286,15 @@ void SimpleStatisticsDialog::fillTree() tapDraw(&stat_data); removeTapListeners(); - free_stat_tables(stu_, NULL, NULL); +} + +SimpleStatisticsDialog::~SimpleStatisticsDialog() +{ + stu_->refcount--; + if (stu_->refcount == 0) { + if (stu_->tables) + free_stat_tables(stu_, NULL, NULL); + } } /* diff --git a/ui/qt/simple_statistics_dialog.h b/ui/qt/simple_statistics_dialog.h index 47d1388514..1c1afe4e22 100644 --- a/ui/qt/simple_statistics_dialog.h +++ b/ui/qt/simple_statistics_dialog.h @@ -49,6 +49,8 @@ private: static void tapReset(void *sd_ptr); static void tapDraw(void *sd_ptr); + ~SimpleStatisticsDialog(); + private slots: virtual void fillTree();