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 /epan/dissectors/packet-gsm_a_common.c | |
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 'epan/dissectors/packet-gsm_a_common.c')
-rw-r--r-- | epan/dissectors/packet-gsm_a_common.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index c2b0c6c6b7..72ceb0a276 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -3598,11 +3598,16 @@ void gsm_a_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_cal /* Add a row for each value type */ for (i = 0; i < 256; i++) { - const char *ocs = try_val_to_str(i, msg_strings); - if (!ocs) ocs = g_strdup_printf("Unknown message %d", i); + const char *msg_str = try_val_to_str(i, msg_strings); + char *col_str; + if (msg_str) { + col_str = g_strdup(msg_str); + } else { + col_str = g_strdup_printf("Unknown message %d", i); + } items[IEI_COLUMN].value.uint_value = i; - items[MSG_NAME_COLUMN].value.string_value = ocs; + items[MSG_NAME_COLUMN].value.string_value = col_str; new_stat_tap_init_table_row(table, i, num_fields, items); } } @@ -3762,6 +3767,13 @@ gsm_a_stat_reset(new_stat_tap_table* table) } } +static void +gsm_a_stat_free_table_item(new_stat_tap_table* table _U_, guint row _U_, guint column, stat_tap_table_item_type* field_data) +{ + if (column != MSG_NAME_COLUMN) return; + g_free((char*)field_data->value.string_value); +} + /* Register the protocol with Wireshark */ void proto_register_gsm_a_common(void) @@ -4713,7 +4725,7 @@ proto_register_gsm_a_common(void) gsm_a_bssmap_stat_init, gsm_a_bssmap_stat_packet, gsm_a_stat_reset, - NULL, + gsm_a_stat_free_table_item, 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, |