diff options
author | Evan Huus <eapache@gmail.com> | 2013-02-08 02:40:05 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-02-08 02:40:05 +0000 |
commit | e1bfc1c61c023521063780186acb6e841d289957 (patch) | |
tree | 81c12a1b6037b917c01798f727aeb7994dd607ad | |
parent | ebc2067e3035fccfa9de423c102f20d235725371 (diff) | |
download | wireshark-e1bfc1c61c023521063780186acb6e841d289957.tar.gz |
Fix issue where using realloc() to shrink a chunk could result in
multiple adjacent free chunks. When splitting a used chunk, the resulting
extra unused chunk may need to be merged to its right.
svn path=/trunk/; revision=47552
-rw-r--r-- | epan/wmem/wmem_allocator_block.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/epan/wmem/wmem_allocator_block.c b/epan/wmem/wmem_allocator_block.c index f0bc9d9b19..94046f666a 100644 --- a/epan/wmem/wmem_allocator_block.c +++ b/epan/wmem/wmem_allocator_block.c @@ -462,6 +462,9 @@ wmem_block_split_used_chunk(wmem_block_allocator_t *allocator, extra->prev = (guint32) (aligned_size + sizeof(wmem_block_chunk_t)); extra->used = FALSE; + /* merge it to its right if possible (it can't be merged left, obviously) */ + wmem_block_merge_free(allocator, extra); + /* add it to the free list */ wmem_block_add_to_free_list(allocator, extra); } |