mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-26 00:57:39 +03:00
malloc: Fix MALLOC_DEBUG
MALLOC_DEBUG only works on locked arenas, so move the call to check_inuse_chunk from __libc_free() to _int_free_chunk(). Regress now passes if MALLOC_DEBUG is enabled. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@@ -3456,8 +3456,6 @@ __libc_free (void *mem)
|
|||||||
if (__glibc_unlikely (misaligned_chunk (p)))
|
if (__glibc_unlikely (misaligned_chunk (p)))
|
||||||
return malloc_printerr_tail ("free(): invalid pointer");
|
return malloc_printerr_tail ("free(): invalid pointer");
|
||||||
|
|
||||||
check_inuse_chunk (arena_for_chunk (p), p);
|
|
||||||
|
|
||||||
#if USE_TCACHE
|
#if USE_TCACHE
|
||||||
if (__glibc_likely (size < mp_.tcache_max_bytes && tcache != NULL))
|
if (__glibc_likely (size < mp_.tcache_max_bytes && tcache != NULL))
|
||||||
{
|
{
|
||||||
@@ -4680,6 +4678,8 @@ _int_free_merge_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size)
|
|||||||
{
|
{
|
||||||
mchunkptr nextchunk = chunk_at_offset(p, size);
|
mchunkptr nextchunk = chunk_at_offset(p, size);
|
||||||
|
|
||||||
|
check_inuse_chunk (av, p);
|
||||||
|
|
||||||
/* Lightweight tests: check whether the block is already the
|
/* Lightweight tests: check whether the block is already the
|
||||||
top block. */
|
top block. */
|
||||||
if (__glibc_unlikely (p == av->top))
|
if (__glibc_unlikely (p == av->top))
|
||||||
|
|||||||
Reference in New Issue
Block a user