diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-08-06 11:23:55 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-08-06 21:22:13 +0000 |
commit | ff24ecceb976e25cf58040b116f25fc218290540 (patch) | |
tree | b6568500814f3dde7bd88e3433af58c503ba9693 /asn1/gsm_map | |
parent | 9fd3bcc25e0b6c1feaf6e20850200de4acf5637a (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/gsm_map')
-rw-r--r-- | asn1/gsm_map/packet-gsm_map-template.c | 18 |
1 files changed, 15 insertions, 3 deletions
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, |