|
|
a65ffb |
diff --git a/epan/packet.c b/epan/packet.c
|
|
|
a65ffb |
index 6c74fd9287..d76fa44037 100644
|
|
|
a65ffb |
--- a/epan/packet.c
|
|
|
a65ffb |
+++ b/epan/packet.c
|
|
|
a65ffb |
@@ -354,9 +354,9 @@ add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, const char *name)
|
|
|
a65ffb |
{
|
|
|
a65ffb |
struct data_source *src;
|
|
|
a65ffb |
|
|
|
a65ffb |
- src = (struct data_source *)g_malloc(sizeof(struct data_source));
|
|
|
a65ffb |
+ src = wmem_new(pinfo->pool, struct data_source);
|
|
|
a65ffb |
src->tvb = tvb;
|
|
|
a65ffb |
- src->name = g_strdup(name);
|
|
|
a65ffb |
+ src->name = wmem_strdup(pinfo->pool, name);
|
|
|
a65ffb |
/* This could end up slow, but we should never have that many data
|
|
|
a65ffb |
* sources so it probably doesn't matter */
|
|
|
a65ffb |
pinfo->data_src = g_slist_append(pinfo->data_src, src);
|
|
|
a65ffb |
@@ -365,14 +365,10 @@ add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, const char *name)
|
|
|
a65ffb |
void
|
|
|
a65ffb |
remove_last_data_source(packet_info *pinfo)
|
|
|
a65ffb |
{
|
|
|
a65ffb |
- struct data_source *src;
|
|
|
a65ffb |
GSList *last;
|
|
|
a65ffb |
|
|
|
a65ffb |
last = g_slist_last(pinfo->data_src);
|
|
|
a65ffb |
- src = (struct data_source *)last->data;
|
|
|
a65ffb |
pinfo->data_src = g_slist_delete_link(pinfo->data_src, last);
|
|
|
a65ffb |
- g_free(src->name);
|
|
|
a65ffb |
- g_slice_free(struct data_source, src);
|
|
|
a65ffb |
}
|
|
|
a65ffb |
|
|
|
a65ffb |
const char*
|
|
|
a65ffb |
@@ -397,14 +393,6 @@ void
|
|
|
a65ffb |
free_data_sources(packet_info *pinfo)
|
|
|
a65ffb |
{
|
|
|
a65ffb |
if (pinfo->data_src) {
|
|
|
a65ffb |
- GSList *l;
|
|
|
a65ffb |
-
|
|
|
a65ffb |
- for (l = pinfo->data_src; l; l = l->next) {
|
|
|
a65ffb |
- struct data_source *src = (struct data_source *)l->data;
|
|
|
a65ffb |
-
|
|
|
a65ffb |
- g_free(src->name);
|
|
|
a65ffb |
- g_free(src);
|
|
|
a65ffb |
- }
|
|
|
a65ffb |
g_slist_free(pinfo->data_src);
|
|
|
a65ffb |
pinfo->data_src = NULL;
|
|
|
a65ffb |
}
|