]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #4838: When a module is deallocated, free the memory backing the optional modul...
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 17 Jan 2009 21:06:43 +0000 (21:06 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 17 Jan 2009 21:06:43 +0000 (21:06 +0000)
Misc/NEWS
Objects/moduleobject.c

index 69c42d27b3f85aadb2e7177dab571886af431020..fee788f7b4edf8888e4f1770bd6d3b12e08dbce9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 3.1 alpha 0
 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 *).
 
index 9c705b888d25e25a8d223db41b69237a36531f67..0c6032fbe85941ee4aa60ee96d6638598abdb7d6 100644 (file)
@@ -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);
 }