diff Python/import.c @ 51192:9867c849530b

Issue #5041: Fixed memory leak.
author Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
date Fri, 30 Jan 2009 03:15:05 +0000
parents 5c7312ce5dbd
children debd14c489b9
line wrap: on
line diff
--- a/Python/import.c	Fri Jan 30 03:01:08 2009 +0000
+++ b/Python/import.c	Fri Jan 30 03:15:05 2009 +0000
@@ -2894,12 +2894,14 @@
 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 *