https://github.com/python/cpython/commit/9c7ef0cc28650520fea1cc5c35b1b3f2d94bc96a commit: 9c7ef0cc28650520fea1cc5c35b1b3f2d94bc96a branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: colesbury <colesb...@gmail.com> date: 2025-03-25T15:15:26Z summary:
[3.13] gh-131719: add NULL pointer check to `_PyMem_FreeDelayed` (gh-131720) (gh-131722) (cherry picked from commit 0a91456ad14bb598646f50bf8f034e8887c0c468) Co-authored-by: Tomasz Pytel <tompy...@gmail.com> 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 4b830f5bb63c69..6f23639645000b 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1160,7 +1160,9 @@ void _PyMem_FreeDelayed(void *ptr) { assert(!((uintptr_t)ptr & 0x01)); - free_delayed((uintptr_t)ptr); + if (ptr != NULL) { + free_delayed((uintptr_t)ptr); + } } void _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com