[3.13] gh-131719: add NULL pointer check to _PyMem_FreeDelayed (gh-131720) (gh-131722)

(cherry picked from commit 0a91456ad1)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-03-25 16:15:26 +01:00 committed by GitHub
parent c22eef44d8
commit 9c7ef0cc28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1 @@
Fix missing NULL check in ``_PyMem_FreeDelayed`` in :term:`free-threaded <free threading>` build.

View file

@ -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