diff options
author | Jason Evans <jasone@canonware.com> | 2012-12-12 18:12:18 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2012-12-12 18:12:18 (GMT) |
commit | 1271185b87fcf54afb37dc05e7e0c58e5fb8f06a (patch) | |
tree | ea52affe51247a2cadfb09ed39439ae4647dd80e /src | |
parent | 6eb84fbe315add1e1d4f8deedc25d260fff3ae97 (diff) | |
download | jemalloc-1271185b87fcf54afb37dc05e7e0c58e5fb8f06a.zip jemalloc-1271185b87fcf54afb37dc05e7e0c58e5fb8f06a.tar.gz jemalloc-1271185b87fcf54afb37dc05e7e0c58e5fb8f06a.tar.bz2 |
Fix chunk_recycle() Valgrind integration.
Fix chunk_recycyle() to unconditionally inform Valgrind that returned
memory is undefined. This fixes Valgrind warnings that would result
from a huge allocation being freed, then recycled for use as an arena
chunk. The arena code would write metadata to the chunk header, and
Valgrind would consider these invalid writes.
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/chunk.c b/src/chunk.c index 1a3bb4f..40c108a 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -122,10 +122,9 @@ chunk_recycle(extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, size_t size, } base_node_dealloc(node); } - if (zeroed == false && *zero) { - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); + if (zeroed == false && *zero) memset(ret, 0, size); - } return (ret); } |