https://github.com/python/cpython/commit/a802277914405786f6425f2776605c44bd407fc0
commit: a802277914405786f6425f2776605c44bd407fc0
branch: main
author: Stefano Rivera <[email protected]>
committer: ericsnowcurrently <[email protected]>
date: 2024-07-10T10:40:55-06:00
summary:
gh-121460: Skip freeing unallocated arenas (gh-121491)
`munmap(NULL)` is not noop, like `free(NULL)` is.
Fixes an observed testsuite hang on 32-bit ARM systems.
files:
M Objects/obmalloc.c
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index d033e2bad1891a..a6a71802ef8e01 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -386,8 +386,16 @@ _PyMem_ArenaFree(void *Py_UNUSED(ctx), void *ptr,
)
{
#ifdef MS_WINDOWS
+ /* Unlike free(), VirtualFree() does not special-case NULL to noop. */
+ if (ptr == NULL) {
+ return;
+ }
VirtualFree(ptr, 0, MEM_RELEASE);
#elif defined(ARENAS_USE_MMAP)
+ /* Unlike free(), munmap() does not special-case NULL to noop. */
+ if (ptr == NULL) {
+ return;
+ }
munmap(ptr, size);
#else
free(ptr);
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]