Skip to content

Commit 8014cf0

Browse files
tom-pyteldiegorusso
authored andcommitted
pythongh-131719: add NULL pointer check to _PyMem_FreeDelayed (pythongh-131720)
1 parent efe41d1 commit 8014cf0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix missing NULL check in ``_PyMem_FreeDelayed`` in :term:`free-threaded <free threading>` build.

Objects/obmalloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,9 @@ void
12151215
_PyMem_FreeDelayed(void *ptr)
12161216
{
12171217
assert(!((uintptr_t)ptr & 0x01));
1218-
free_delayed((uintptr_t)ptr);
1218+
if (ptr != NULL) {
1219+
free_delayed((uintptr_t)ptr);
1220+
}
12191221
}
12201222

12211223
#ifdef Py_GIL_DISABLED

0 commit comments

Comments
 (0)