]> granicus.if.org Git - python/commitdiff
- Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
authorBarry Warsaw <barry@python.org>
Tue, 20 Sep 2011 18:45:44 +0000 (14:45 -0400)
committerBarry Warsaw <barry@python.org>
Tue, 20 Sep 2011 18:45:44 +0000 (14:45 -0400)
  finding the bug and providing a patch.

Misc/NEWS
Python/pythonrun.c

index bc52aa8ae983e6ad6e60e3937f921cc393bb02de..1d0338524697c14f686a3773d11a73b681507b40 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.2.3?
 Core and Builtins
 -----------------
 
+- Issue #13021: Missing decref on an error path.  Thanks to Suman Saha for
+  finding the bug and providing a patch.
+
 - Issue #12973: Fix overflow check that relied on undefined behaviour in
   list_repeat.  This bug caused test_list to fail with recent versions
   of Clang.
index 084db12f635e12ea6dd60f5ebc0c2aa2bebdd2cf..bea7fe1544614bc6575c63d43352c093ab8eb077 100644 (file)
@@ -1241,8 +1241,10 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
             Py_DECREF(f);
             return -1;
         }
-        if (PyDict_SetItemString(d, "__cached__", Py_None) < 0)
+        if (PyDict_SetItemString(d, "__cached__", Py_None) < 0) {
+            Py_DECREF(f);
             return -1;
+        }
         set_file_name = 1;
         Py_DECREF(f);
     }