summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-19 15:51:49 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-19 15:51:49 (GMT)
commitd925bd5794e46e0952677ecdd6bf620bcbc719ae (patch)
treea9b564471e5a9dbc5976b0d37a9ac5f32b7d2de2
parent53926f19cd205af02b7b064f30adef9c1f00f6da (diff)
downloadcpython-d925bd5794e46e0952677ecdd6bf620bcbc719ae.zip
cpython-d925bd5794e46e0952677ecdd6bf620bcbc719ae.tar.gz
cpython-d925bd5794e46e0952677ecdd6bf620bcbc719ae.tar.bz2
Fix a refleak in call_method()
Issue #27128. Fix a reference leak if creating the tuple to pass positional parameters fails.
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 9f57a7e..a78f328 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1432,8 +1432,10 @@ call_method(PyObject *o, _Py_Identifier *nameid, char *format, ...)
va_end(va);
- if (args == NULL)
+ if (args == NULL) {
+ Py_DECREF(func);
return NULL;
+ }
assert(PyTuple_Check(args));
retval = PyObject_Call(func, args, NULL);