Skip to content

Commit 9c7ef0c

Browse files
[3.13] gh-131719: add NULL pointer check to _PyMem_FreeDelayed (gh-131720) (gh-131722)
(cherry picked from commit 0a91456) Co-authored-by: Tomasz Pytel <[email protected]>
1 parent c22eef4 commit 9c7ef0c

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)