From: Barry Warsaw <barry@python.org>
Date: Wed, 27 Jan 1999 17:54:20 +0000 (+0000)
Subject: PyImport_ReloadModule(): Nailed a small memory leak.  In the
X-Git-Tag: v1.5.2b2~257
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3879333b9eef62541a68d8c7fd3e95e544a1ebda;p=python

PyImport_ReloadModule(): Nailed a small memory leak.  In the
else-clause of the subname test, the parentname object was never
DECREF'd.
---

diff --git a/Python/import.c b/Python/import.c
index feed81cdf9..936cbda06d 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1800,6 +1800,7 @@ PyImport_ReloadModule(m)
 		if (parentname == NULL)
 			return NULL;
 		parent = PyDict_GetItem(modules, parentname);
+		Py_DECREF(parentname);
 		if (parent == NULL) {
 			PyErr_Format(PyExc_ImportError,
 			    "reload(): parent %.200s not in sys.modules",