mirror of
https://github.com/python/cpython.git
synced 2026-06-06 18:01:04 +00:00
gh-146527: Fix memory leak in _PyGC_Fini() (#150969)
Free generation_stats allocated by _PyGC_Init(). Fix Python/gc.c: Python/gc_free_threading.c was already fixed.
This commit is contained in:
parent
c195a046f8
commit
0036565e81
1 changed files with 2 additions and 0 deletions
|
|
@ -1876,6 +1876,8 @@ _PyGC_Fini(PyInterpreterState *interp)
|
|||
GCState *gcstate = &interp->gc;
|
||||
Py_CLEAR(gcstate->garbage);
|
||||
Py_CLEAR(gcstate->callbacks);
|
||||
PyMem_RawFree(gcstate->generation_stats);
|
||||
gcstate->generation_stats = NULL;
|
||||
|
||||
/* Prevent a subtle bug that affects sub-interpreters that use basic
|
||||
* single-phase init extensions (m_size == -1). Those extensions cause objects
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue