[Python-checkins] r85561 - python/branches/py3k/Python/import.c

benjamin.peterson python-checkins at python.org
Sat Oct 16 05:12:39 CEST 2010


Author: benjamin.peterson
Date: Sat Oct 16 05:12:39 2010
New Revision: 85561

Log:
fix refleak

Modified:
   python/branches/py3k/Python/import.c

Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c	(original)
+++ python/branches/py3k/Python/import.c	Sat Oct 16 05:12:39 2010
@@ -3462,7 +3462,7 @@
     char buf[MAXPATHLEN+1];
     PyObject *pathbytes;
     char *cpathname;
-    PyObject *debug_override = Py_None;
+    PyObject *debug_override = NULL;
     int debug = !Py_OptimizeFlag;
 
     if (!PyArg_ParseTupleAndKeywords(
@@ -3470,9 +3470,11 @@
                 PyUnicode_FSConverter, &pathbytes, &debug_override))
         return NULL;
 
-    if (debug_override != Py_None)
-        if ((debug = PyObject_IsTrue(debug_override)) < 0)
-            return NULL;
+    if (debug_override != NULL &&
+        (debug = PyObject_IsTrue(debug_override)) < 0) {
+        Py_DECREF(pathbytes);
+        return NULL;
+    }
 
     cpathname = make_compiled_pathname(
         PyBytes_AS_STRING(pathbytes),


More information about the Python-checkins mailing list