diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-11-03 03:49:34 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-11-03 03:49:34 +0000 |
commit | f62a97cf2dc1d7235f0cc9058ff31e724ffe2c02 (patch) | |
tree | 0d500b8d3e8156001a5cb98529d18e12a775856a /epan | |
parent | ba06fa649028dc683296a3411edb0b0bd8e1c1ee (diff) |
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
Diffstat (limited to 'epan')
-rw-r--r-- | epan/tvbuff.c | 16 |
1 files changed, 11 insertions, 5 deletions
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 <gram@xiexie.org> * @@ -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); } } |