}
}
+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)
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,
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);
}
}
}
}
+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)
{
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,
free_rtd_table@Base 1.99.8
free_srt_table@Base 1.99.8
free_srt_table_data@Base 1.99.8
- free_stat_table@Base 1.99.8
+ free_stat_tables@Base 1.99.9
ftype_can_contains@Base 1.9.1
ftype_can_eq@Base 1.9.1
ftype_can_ge@Base 1.9.1
}
}
+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)
/*--- End of included file: packet-camel-dis-tab.c ---*/
-#line 1328 "../../asn1/camel/packet-camel-template.c"
+#line 1334 "../../asn1/camel/packet-camel-template.c"
} else {
range_foreach(ssn_range, range_delete_callback);
g_free(ssn_range);
"InvokeId_present", HFILL }},
/*--- End of included file: packet-camel-hfarr.c ---*/
-#line 1501 "../../asn1/camel/packet-camel-template.c"
+#line 1507 "../../asn1/camel/packet-camel-template.c"
};
/* List of subtrees */
&ett_camel_InvokeId,
/*--- End of included file: packet-camel-ettarr.c ---*/
-#line 1518 "../../asn1/camel/packet-camel-template.c"
+#line 1524 "../../asn1/camel/packet-camel-template.c"
};
static ei_register_info ei[] = {
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,
/* 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);
}
}
}
}
+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)
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,
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);
}
}
}
}
+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)
{
NULL, HFILL }},
/*--- End of included file: packet-gsm_map-hfarr.c ---*/
-#line 3039 "../../asn1/gsm_map/packet-gsm_map-template.c"
+#line 3051 "../../asn1/gsm_map/packet-gsm_map-template.c"
};
/* List of subtrees */
&ett_NokiaMAP_Extensions_AllowedServiceData,
/*--- End of included file: packet-gsm_map-ettarr.c ---*/
-#line 3073 "../../asn1/gsm_map/packet-gsm_map-template.c"
+#line 3085 "../../asn1/gsm_map/packet-gsm_map-template.c"
};
static ei_register_info ei[] = {
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,
/*--- End of included file: packet-gsm_map-dis-tab.c ---*/
-#line 3129 "../../asn1/gsm_map/packet-gsm_map-template.c"
+#line 3141 "../../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" );
}
}
-void free_stat_table(new_stat_tap_ui* new_stat, new_stat_tap_gui_free_cb gui_callback, void *callback_data)
+void free_stat_tables(new_stat_tap_ui* new_stat, new_stat_tap_gui_free_cb gui_callback, void *callback_data)
{
guint i = 0, element, field_index;
new_stat_tap_table *stat_table;
{
field_data = new_stat_tap_get_field_data(stat_table, element, field_index);
/* Give dissector a crack at it */
+ /* XXX Should this be per-row instead? */
if (new_stat->stat_tap_free_table_item_cb)
new_stat->stat_tap_free_table_item_cb(stat_table, element, field_index, field_data);
}
+ g_free(stat_table->elements[element]);
}
+ g_free(stat_table->elements);
+ g_free(stat_table);
}
+ g_array_set_size(new_stat->tables, 0);
}
WS_DLL_PUBLIC stat_tap_table_item_type* new_stat_tap_get_field_data(const new_stat_tap_table *stat_table, guint table_index, guint field_index);
WS_DLL_PUBLIC void new_stat_tap_set_field_data(new_stat_tap_table *stat_table, guint table_index, guint field_index, stat_tap_table_item_type* field_data);
WS_DLL_PUBLIC void reset_stat_table(new_stat_tap_ui* new_stat, new_stat_tap_gui_reset_cb gui_callback, void *callback_data);
-WS_DLL_PUBLIC void free_stat_table(new_stat_tap_ui* new_stat, new_stat_tap_gui_free_cb gui_callback, void *callback_data);
+
+/** Free all of the tables associated with a new_stat_tap_ui.
+ *
+ * Frees data created by stat_tap_ui.stat_tap_init_cb.
+ * new_stat_tap_ui.stat_tap_free_table_item_cb is called for each index in each
+ * row.
+ *
+ * @param new_stat Parent new_stat_tap_ui struct, provided by the dissector.
+ * @param gui_callback Per-table callback, run before rows are removed.
+ * Provided by the UI.
+ * @param callback_data Data for the per-table callback.
+ */
+WS_DLL_PUBLIC void free_stat_tables(new_stat_tap_ui* new_stat, new_stat_tap_gui_free_cb gui_callback, void *callback_data);
WS_DLL_PUBLIC gboolean process_stat_cmd_arg(char *optstr);
remove_tap_listener(&ss->data);
- free_stat_table(ss->new_stat_tap, NULL, NULL);
+ free_stat_tables(ss->new_stat_tap, NULL, NULL);
g_free(ss);
}
if(error_string){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
g_string_free(error_string, TRUE);
- free_stat_table(ss->new_stat_tap, NULL, NULL);
+ free_stat_tables(ss->new_stat_tap, NULL, NULL);
g_free(ss);
return;
}
QMessageBox::critical(this, tr("Failed to attach to tap \"%1\"").arg(stu_->tap_name),
error_string->str);
g_string_free(error_string, TRUE);
- free_stat_table(stu_, NULL, NULL);
+ free_stat_tables(stu_, NULL, NULL);
reject();
}
tapDraw(&stat_data);
remove_tap_listener(&stat_data);
- free_stat_table(stu_, NULL, NULL);
+ free_stat_tables(stu_, NULL, NULL);
}
/*