Skip to content

Commit cbd4749

Browse files
tom-pytelmiss-islington
authored andcommitted
pythongh-131719: add NULL pointer check to _PyMem_FreeDelayed (pythongh-131720)
(cherry picked from commit 0a91456) Co-authored-by: Tomasz Pytel <[email protected]>
1 parent c22eef4 commit cbd4749

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
@@ -1160,7 +1160,9 @@ void
11601160
_PyMem_FreeDelayed(void *ptr)
11611161
{
11621162
assert(!((uintptr_t)ptr & 0x01));
1163-
free_delayed((uintptr_t)ptr);
1163+
if (ptr != NULL) {
1164+
free_delayed((uintptr_t)ptr);
1165+
}
11641166
}
11651167

11661168
void

0 commit comments

Comments
 (0)