diff options
author | Jason Evans <jasone@canonware.com> | 2013-10-20 04:40:20 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2013-10-20 04:40:20 (GMT) |
commit | 87a02d2bb18dbcb2955541b849bc95862e864803 (patch) | |
tree | 5a0c6fb9171e09687dff7fe20fe4de28f7125a01 /src/arena.c | |
parent | 543abf7e6c7de06fe9654e91190b5c44a11b065e (diff) | |
download | jemalloc-87a02d2bb18dbcb2955541b849bc95862e864803.zip jemalloc-87a02d2bb18dbcb2955541b849bc95862e864803.tar.gz jemalloc-87a02d2bb18dbcb2955541b849bc95862e864803.tar.bz2 |
Fix a Valgrind integration flaw.
Fix a Valgrind integration flaw that caused Valgrind warnings about
reads of uninitialized memory in arena chunk headers.
Diffstat (limited to 'src/arena.c')
-rw-r--r-- | src/arena.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/arena.c b/src/arena.c index 05a787f..0a73be2 100644 --- a/src/arena.c +++ b/src/arena.c @@ -569,17 +569,24 @@ arena_chunk_alloc(arena_t *arena) * unless the chunk is not zeroed. */ if (zero == false) { + VALGRIND_MAKE_MEM_UNDEFINED( + (void *)arena_mapp_get(chunk, map_bias+1), + (size_t)((uintptr_t) arena_mapp_get(chunk, + chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk, + map_bias+1))); for (i = map_bias+1; i < chunk_npages-1; i++) arena_mapbits_unzeroed_set(chunk, i, unzeroed); - } else if (config_debug) { + } else { VALGRIND_MAKE_MEM_DEFINED( (void *)arena_mapp_get(chunk, map_bias+1), - (void *)((uintptr_t) - arena_mapp_get(chunk, chunk_npages-1) - - (uintptr_t)arena_mapp_get(chunk, map_bias+1))); - for (i = map_bias+1; i < chunk_npages-1; i++) { - assert(arena_mapbits_unzeroed_get(chunk, i) == - unzeroed); + (size_t)((uintptr_t) arena_mapp_get(chunk, + chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk, + map_bias+1))); + if (config_debug) { + for (i = map_bias+1; i < chunk_npages-1; i++) { + assert(arena_mapbits_unzeroed_get(chunk, + i) == unzeroed); + } } } arena_mapbits_unallocated_set(chunk, chunk_npages-1, |