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