mirror of https://github.com/python/cpython
[3.13] gh-121460: Skip freeing unallocated arenas (gh-121589)
`munmap(NULL)` is not noop, like `free(NULL)` is.
Fixes an observed testsuite hang on 32-bit ARM systems.
(cherry picked from commit a802277914
, AKA gh-121491)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
This commit is contained in:
parent
0113c56a20
commit
867cf40279
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue