From: Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Date: Fri, 30 Jan 2009 03:15:05 +0000 (+0000)
Subject: Issue #5041: Fixed memory leak.
X-Git-Tag: v3.1a1~342
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90eaaf623a7143153fd6d1b9f917b394c923a14a;p=python

Issue #5041: Fixed memory leak.
---

diff --git a/Python/import.c b/Python/import.c
index 37e3f4b598..d741acae6b 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2894,12 +2894,14 @@ static PyObject *
 imp_find_module(PyObject *self, PyObject *args)
 {
 	char *name;
-	PyObject *path = NULL;
+	PyObject *ret, *path = NULL;
 	if (!PyArg_ParseTuple(args, "es|O:find_module",
 	                      Py_FileSystemDefaultEncoding, &name,
 	                      &path))
 		return NULL;
-	return call_find_module(name, path);
+	ret = call_find_module(name, path);
+	PyMem_Free(name);
+	return ret;
 }
 
 static PyObject *