From f0b20a7ffcc6a941a103ad75d5c959c44710a17f Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sat, 17 Jan 2009 21:40:04 +0000 Subject: [PATCH] Merged revisions 68669 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r68669 | antoine.pitrou | 2009-01-17 22:06:43 +0100 (sam., 17 janv. 2009) | 3 lines Issue #4838: When a module is deallocated, free the memory backing the optional module state data. ........ --- Misc/NEWS | 3 +++ Objects/moduleobject.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 1bd6c05083e8..43ab22426f3f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ What's New in Python 3.0.1? Core and Builtins ----------------- +- Issue #4838: When a module is deallocated, free the memory backing the + optional module state data. + - Issue #4910: Rename nb_long slot to nb_reserved, and change its type to (void *). diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 9c705b888d25..0c6032fbe859 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -315,6 +315,8 @@ module_dealloc(PyModuleObject *m) _PyModule_Clear((PyObject *)m); Py_DECREF(m->md_dict); } + if (m->md_state != NULL) + PyMem_FREE(m->md_state); Py_TYPE(m)->tp_free((PyObject *)m); } -- 2.47.3