https://github.com/python/cpython/commit/0a91456ad14bb598646f50bf8f034e8887c0c468
commit: 0a91456ad14bb598646f50bf8f034e8887c0c468
branch: main
author: Tomasz Pytel <[email protected]>
committer: colesbury <[email protected]>
date: 2025-03-25T10:49:18-04:00
summary:
gh-131719: add NULL pointer check to `_PyMem_FreeDelayed` (gh-131720)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2025-03-25-13-58-25.gh-issue-131719.zKv98a.rst
M Objects/obmalloc.c
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2025-03-25-13-58-25.gh-issue-131719.zKv98a.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2025-03-25-13-58-25.gh-issue-131719.zKv98a.rst
new file mode 100644
index 00000000000000..ad917553270349
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2025-03-25-13-58-25.gh-issue-131719.zKv98a.rst
@@ -0,0 +1 @@
+Fix missing NULL check in ``_PyMem_FreeDelayed`` in :term:`free-threaded <free
threading>` build.
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 1285398142933a..b209808da902da 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -1215,7 +1215,9 @@ void
_PyMem_FreeDelayed(void *ptr)
{
assert(!((uintptr_t)ptr & 0x01));
- free_delayed((uintptr_t)ptr);
+ if (ptr != NULL) {
+ free_delayed((uintptr_t)ptr);
+ }
}
#ifdef Py_GIL_DISABLED
_______________________________________________
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]