Some PyMem_Realloc() / PyMem_RawRealloc() calls overwrite the original pointer directly.
If realloc fails, the old pointer is still valid, but it can be lost and leaked. See the comming PR for detail.
This is found using Claude Code.
CPython main branch
No response
gh-149931: Fix memory leaks on failed realloc (#149932)
[3.15] gh-149931: Fix memory leaks on failed realloc (GH-149932) (#15…
[3.14] gh-149931: Fix memory leaks on failed realloc (#150476)
Activity
gh-149931: Fix memory leaks on failed realloc (#149932)
[3.15] gh-149931: Fix memory leaks on failed realloc (GH-149932) (#15…
[3.14] gh-149931: Fix memory leaks on failed realloc (#150476)