aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-08-06 11:23:55 -0700
committerGerald Combs <gerald@wireshark.org>2015-08-06 21:22:13 +0000
commitff24ecceb976e25cf58040b116f25fc218290540 (patch)
treeb6568500814f3dde7bd88e3433af58c503ba9693 /asn1
parent9fd3bcc25e0b6c1feaf6e20850200de4acf5637a (diff)
Fixup stat_tap table freeing.
As it turns out we *do* need to free table elements. We also need to free the tables themselves and clear the table array. Do so. Change-Id: Ic1c81388eac8f47f74caea0169c79685a83aaff9 Reviewed-on: https://code.wireshark.org/review/9901 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'asn1')
-rw-r--r--asn1/camel/packet-camel-template.c8
-rw-r--r--asn1/gsm_map/packet-gsm_map-template.c18
2 files changed, 22 insertions, 4 deletions
diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c
index 152aabad7c..1d77cb779a 100644
--- a/asn1/camel/packet-camel-template.c
+++ b/asn1/camel/packet-camel-template.c
@@ -1285,6 +1285,12 @@ camel_stat_reset(new_stat_tap_table* table)
}
}
+static void
+camel_stat_free_table_item(new_stat_tap_table* table _U_, guint row _U_, guint column, stat_tap_table_item_type* field_data)
+{
+ if (column != MESSAGE_TYPE_COLUMN) return;
+ g_free((char*)field_data->value.string_value);
+}
/*--- proto_reg_handoff_camel ---------------------------------------*/
static void range_delete_callback(guint32 ssn)
@@ -1537,7 +1543,7 @@ void proto_register_camel(void) {
camel_stat_init,
camel_stat_packet,
camel_stat_reset,
- NULL,
+ camel_stat_free_table_item,
NULL,
sizeof(camel_stat_fields)/sizeof(stat_tap_table_item), camel_stat_fields,
sizeof(camel_stat_params)/sizeof(tap_param), camel_stat_params,
diff --git a/asn1/gsm_map/packet-gsm_map-template.c b/asn1/gsm_map/packet-gsm_map-template.c
index 54ba888c47..300d685dc0 100644
--- a/asn1/gsm_map/packet-gsm_map-template.c
+++ b/asn1/gsm_map/packet-gsm_map-template.c
@@ -2512,10 +2512,15 @@ void gsm_map_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_c
for (i = 0; i < GSM_MAP_MAX_NUM_OPR_CODES; i++)
{
const char *ocs = try_val_to_str(i, gsm_map_opr_code_strings);
- if (!ocs) ocs = g_strdup_printf("Unknown op code %d", i);
+ char *col_str;
+ if (ocs) {
+ col_str = g_strdup(ocs);
+ } else {
+ col_str = g_strdup_printf("Unknown op code %d", i);
+ }
items[ID_COLUMN].value.uint_value = i;
- items[OP_CODE_COLUMN].value.string_value = ocs;
+ items[OP_CODE_COLUMN].value.string_value = col_str;
new_stat_tap_init_table_row(table, i, num_fields, items);
}
}
@@ -2592,6 +2597,13 @@ gsm_map_stat_reset(new_stat_tap_table* table)
}
}
+static void
+gsm_map_stat_free_table_item(new_stat_tap_table* table _U_, guint row _U_, guint column, stat_tap_table_item_type* field_data)
+{
+ if (column != OP_CODE_COLUMN) return;
+ g_free((char*)field_data->value.string_value);
+}
+
/*--- proto_reg_handoff_gsm_map ---------------------------------------*/
static void range_delete_callback(guint32 ssn)
{
@@ -3100,7 +3112,7 @@ void proto_register_gsm_map(void) {
gsm_map_stat_init,
gsm_map_stat_packet,
gsm_map_stat_reset,
- NULL,
+ gsm_map_stat_free_table_item,
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,