static void
free_timestamp_cb(gpointer data, gpointer user_data _U_)
{
- /* timestamp_info_t's contents are immutable and in static memory,
- * so we only need to free the struct itself
- */
+ timestamp_info_t *timestamp_info = (timestamp_info_t *)data;
+
+ g_free(timestamp_info->name);
+ g_free(timestamp_info->description);
g_free(data);
}
while (ntypes--) {
timestamp_info_t *info = (timestamp_info_t *)g_malloc(sizeof *info);
- info->name = pcap_tstamp_type_val_to_name(types[ntypes]);
- info->description = pcap_tstamp_type_val_to_description(types[ntypes]);
+ info->name = g_strdup(pcap_tstamp_type_val_to_name(types[ntypes]));
+ info->description = g_strdup(pcap_tstamp_type_val_to_description(types[ntypes]));
list = g_list_prepend(list, info);
}
* Information about timestamp types.
*/
typedef struct {
- const char *name; /* e.g. "adapter_unsynced" */
- const char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
+ char *name; /* e.g. "adapter_unsynced" */
+ char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
} timestamp_info_t;
/**