[PATCH v5 1/7] malloc: replace _int_free by _int_free_chunk in sysmalloc.
Cupertino Miranda
cupertino.miranda@oracle.com
Fri Mar 21 12:00:56 GMT 2025
sysmalloc calls to _int_free should not allow the freed chunks to be
taken by tcache. These internal calls to free do not reflect any of the
needs of the application, but rather chunk management.
This code replaces those calls to _int_free by calls to _int_free_chunk.
---
malloc/malloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index b73ddbf554..59b22b3455 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2646,7 +2646,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
CHUNK_HDR_SZ | PREV_INUSE);
set_foot (chunk_at_offset (old_top, old_size), CHUNK_HDR_SZ);
set_head (old_top, old_size | PREV_INUSE | NON_MAIN_ARENA);
- _int_free (av, old_top, 1);
+ _int_free_chunk (av, old_top, chunksize (old_top), 1);
}
else
{
@@ -2912,7 +2912,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
/* If possible, release the rest. */
if (old_size >= MINSIZE)
{
- _int_free (av, old_top, 1);
+ _int_free_chunk (av, old_top, chunksize (old_top), 1);
}
}
}
--
2.39.5
More information about the Libc-alpha
mailing list