[Python-checkins] cpython (3.2): Issue #15404: Refleak in PyMethodObject repr.

andrew.svetlov python-checkins at python.org
Fri Jul 20 13:57:54 CEST 2012


http://hg.python.org/cpython/rev/4b724884c81f
changeset:   78191:4b724884c81f
branch:      3.2
parent:      78188:6b771075cfa3
user:        Andrew Svetlov <andrew.svetlov at gmail.com>
date:        Fri Jul 20 14:51:45 2012 +0300
summary:
  Issue #15404: Refleak in PyMethodObject repr.

files:
  Misc/NEWS             |  2 ++
  Objects/classobject.c |  4 +++-
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
 Core and Builtins
 -----------------
 
+- Issue #15404: Refleak in PyMethodObject repr.
+
 - Issue #15394: An issue in PyModule_Create that caused references to
   be leaked on some error paths has been fixed.  Patch by Julia Lawall.
 
diff --git a/Objects/classobject.c b/Objects/classobject.c
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -243,8 +243,10 @@
     else {
         klassname = PyObject_GetAttrString(klass, "__name__");
         if (klassname == NULL) {
-            if (!PyErr_ExceptionMatches(PyExc_AttributeError))
+            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
+                Py_XDECREF(funcname);
                 return NULL;
+            }
             PyErr_Clear();
         }
         else if (!PyUnicode_Check(klassname)) {

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


More information about the Python-checkins mailing list