mirror of
https://github.com/python/cpython.git
synced 2025-11-29 06:22:10 +00:00
Issue #11826: Fix memory leak in atexitmodule.
This commit is contained in:
parent
dc5a4e1611
commit
650365b163
1 changed files with 9 additions and 1 deletions
|
|
@ -211,6 +211,14 @@ atexit_clear(PyObject *self, PyObject *unused)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
atexit_free(PyObject *m)
|
||||||
|
{
|
||||||
|
atexitmodule_state *modstate;
|
||||||
|
modstate = GET_ATEXIT_STATE(m);
|
||||||
|
PyMem_Free(modstate->atexit_callbacks);
|
||||||
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(atexit_unregister__doc__,
|
PyDoc_STRVAR(atexit_unregister__doc__,
|
||||||
"unregister(func) -> None\n\
|
"unregister(func) -> None\n\
|
||||||
\n\
|
\n\
|
||||||
|
|
@ -275,7 +283,7 @@ static struct PyModuleDef atexitmodule = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
(freefunc)atexit_free
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue