[Python-checkins] cpython (3.2): - Issue #13021: Missing decref on an error path. Thanks to Suman Saha for

barry.warsaw python-checkins at python.org
Tue Sep 20 20:58:40 CEST 2011


http://hg.python.org/cpython/rev/7a48e98915f2
changeset:   72423:7a48e98915f2
branch:      3.2
parent:      72417:99b808c94834
user:        Barry Warsaw <barry at python.org>
date:        Tue Sep 20 14:45:44 2011 -0400
summary:
  - Issue #13021: Missing decref on an error path.  Thanks to Suman Saha for
  finding the bug and providing a patch.

files:
  Misc/NEWS          |  3 +++
  Python/pythonrun.c |  4 +++-
  2 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 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.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1241,8 +1241,10 @@
             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);
     }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list