Kaydet (Commit) 650365b1 authored tarafından Stefan Krah's avatar Stefan Krah

Issue #11826: Fix memory leak in atexitmodule.

üst dc5a4e16
...@@ -211,6 +211,14 @@ atexit_clear(PyObject *self, PyObject *unused) ...@@ -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 = { ...@@ -275,7 +283,7 @@ static struct PyModuleDef atexitmodule = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL (freefunc)atexit_free
}; };
PyMODINIT_FUNC PyMODINIT_FUNC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment