aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilco Dijkstra <wilco.dijkstra@arm.com>2025-08-02 17:18:57 +0000
committerWilco Dijkstra <wilco.dijkstra@arm.com>2025-08-04 17:13:55 +0000
commit4b3e65682d1895a651653d82f05c66ead8dfcf3b (patch)
tree17e8c548cdb0ae0685b4e3009ace0b1d38223ba5
parent77d3e739360ebb49bae6ecfd4181e4e1692f6362 (diff)
downloadglibc-4b3e65682d1895a651653d82f05c66ead8dfcf3b.zip
glibc-4b3e65682d1895a651653d82f05c66ead8dfcf3b.tar.gz
glibc-4b3e65682d1895a651653d82f05c66ead8dfcf3b.tar.bz2
Improve MALLOC_DEBUG
-rw-r--r--malloc/malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 2ac5625..415c59a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3460,8 +3460,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))
{
@@ -4679,6 +4677,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))