]> granicus.if.org Git - python/commitdiff
Issue #15404: Refleak in PyMethodObject repr.
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Fri, 20 Jul 2012 11:51:45 +0000 (14:51 +0300)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Fri, 20 Jul 2012 11:51:45 +0000 (14:51 +0300)
Misc/NEWS
Objects/classobject.c

index 0136a4425b25eb33df84977cebd5712259130d4b..d8dfea77429a3a3b87ee46692694b0a9dbaa0b39 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@ What's New in Python 3.2.4
 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.
 
index 6df930fdcf629b35aa2f54b7d181927114d0476e..b7d35ef8852e39ce1f904b4ae7512c3b3f522223 100644 (file)
@@ -243,8 +243,10 @@ method_repr(PyMethodObject *a)
     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)) {