summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS2
-rw-r--r--Objects/classobject.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 0136a44..d8dfea7 100644
--- 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.
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 6df930f..b7d35ef 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -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)) {