Fix two valgrind integration regressions.

The regressions were never merged into the master branch.
This commit is contained in:
Jason Evans 2015-06-22 14:38:06 -07:00
parent 713b844bff
commit 4f6f2b131e
2 changed files with 9 additions and 3 deletions

View File

@ -121,7 +121,7 @@ base_alloc(size_t size)
base_resident += PAGE_CEILING((uintptr_t)ret + csize) - base_resident += PAGE_CEILING((uintptr_t)ret + csize) -
PAGE_CEILING((uintptr_t)ret); PAGE_CEILING((uintptr_t)ret);
} }
JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, csize); JEMALLOC_VALGRIND_MAKE_MEM_DEFINED(ret, csize);
label_return: label_return:
malloc_mutex_unlock(&base_mtx); malloc_mutex_unlock(&base_mtx);
return (ret); return (ret);

View File

@ -277,15 +277,21 @@ void *
chunk_alloc_cache(arena_t *arena, void *new_addr, size_t size, size_t alignment, chunk_alloc_cache(arena_t *arena, void *new_addr, size_t size, size_t alignment,
bool *zero, bool dalloc_node) bool *zero, bool dalloc_node)
{ {
void *ret;
assert(size != 0); assert(size != 0);
assert((size & chunksize_mask) == 0); assert((size & chunksize_mask) == 0);
assert(alignment != 0); assert(alignment != 0);
assert((alignment & chunksize_mask) == 0); assert((alignment & chunksize_mask) == 0);
return (chunk_recycle(arena, &arena->chunks_szad_cache, ret = chunk_recycle(arena, &arena->chunks_szad_cache,
&arena->chunks_ad_cache, true, new_addr, size, alignment, zero, &arena->chunks_ad_cache, true, new_addr, size, alignment, zero,
dalloc_node)); dalloc_node);
if (ret == NULL)
return (NULL);
if (config_valgrind)
JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
return (ret);
} }
static arena_t * static arena_t *