diff options
author | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2025-08-08 14:00:43 +0000 |
---|---|---|
committer | Wilco Dijkstra <wilco.dijkstra@arm.com> | 2025-08-08 14:00:43 +0000 |
commit | a5e9269f51791e4f55f6087b3be10636a7007ca7 (patch) | |
tree | 88bc87627da5deee61c503d50c5186d209f07ea2 /malloc/malloc.c | |
parent | 05a14648e92c3da5fa44bdd24e6b56f8d9f38b1a (diff) | |
download | glibc-a5e9269f51791e4f55f6087b3be10636a7007ca7.zip glibc-a5e9269f51791e4f55f6087b3be10636a7007ca7.tar.gz glibc-a5e9269f51791e4f55f6087b3be10636a7007ca7.tar.bz2 |
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>
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 5257ee2..3a8aaeb 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3456,8 +3456,6 @@ __libc_free (void *mem) if (__glibc_unlikely (misaligned_chunk (p))) return malloc_printerr_tail ("free(): invalid pointer"); - check_inuse_chunk (arena_for_chunk (p), p); - #if USE_TCACHE 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); + check_inuse_chunk (av, p); + /* Lightweight tests: check whether the block is already the top block. */ if (__glibc_unlikely (p == av->top)) |