diff options
-rw-r--r-- | caputils/capture-pcap-util.c | 11 | ||||
-rw-r--r-- | caputils/capture_ifinfo.h | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c index 07d7db06f7..910918c28d 100644 --- a/caputils/capture-pcap-util.c +++ b/caputils/capture-pcap-util.c @@ -671,9 +671,10 @@ free_linktype_cb(gpointer data, gpointer user_data _U_) 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); } @@ -987,8 +988,8 @@ get_pcap_timestamp_types(pcap_t *pch _U_, char **err_str _U_) 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); } diff --git a/caputils/capture_ifinfo.h b/caputils/capture_ifinfo.h index 48c54feec8..65084b8d60 100644 --- a/caputils/capture_ifinfo.h +++ b/caputils/capture_ifinfo.h @@ -115,8 +115,8 @@ typedef struct { * 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; /** |