From f62a97cf2dc1d7235f0cc9058ff31e724ffe2c02 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 3 Nov 2001 03:49:34 +0000 Subject: TVBUFF_SUBSET tvbuffs share a "ds_name" with the parent tvbuff, so their "ds_name"s shouldn't be freed when the tvbuff is freed. (Thanks and a tip of the Hatlo hat to the FreeBSD memory allocator for complaining about multiple frees of the same string.) svn path=/trunk/; revision=4136 --- epan/tvbuff.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'epan') diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 58fdd9324e..65a96084b0 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -9,7 +9,7 @@ * the data of a backing tvbuff, or can be a composite of * other tvbuffs. * - * $Id: tvbuff.c,v 1.23 2001/11/03 03:41:35 guy Exp $ + * $Id: tvbuff.c,v 1.24 2001/11/03 03:49:34 guy Exp $ * * Copyright (c) 2000 by Gilbert Ramirez * @@ -204,6 +204,8 @@ tvb_free(tvbuff_t* tvb) if (tvb->free_cb) { tvb->free_cb(tvb->real_data); } + if (tvb->ds_name) + g_free(tvb->ds_name); break; case TVBUFF_SUBSET: @@ -212,6 +214,12 @@ tvb_free(tvbuff_t* tvb) if (tvb->tvbuffs.subset.tvb) { tvb_decrement_usage_count(tvb->tvbuffs.subset.tvb, 1); } + + /* + * TVBUFF_SUBSET tvbuffs share a "ds_name" with + * the parent tvbuff, so this tvbuff's "ds_name" + * shouldn't be freed. + */ break; case TVBUFF_COMPOSITE: @@ -229,6 +237,8 @@ tvb_free(tvbuff_t* tvb) g_free(composite->end_offsets); if (tvb->real_data) g_free(tvb->real_data); + if (tvb->ds_name) + g_free(tvb->ds_name); break; } @@ -237,10 +247,6 @@ tvb_free(tvbuff_t* tvb) g_slist_free(tvb->used_in); } - if (tvb->ds_name) { - g_free(tvb->ds_name); - } - g_chunk_free(tvb, tvbuff_mem_chunk); } } -- cgit v1.2.3