From c9921d3bdc6717ba221b1338d4d7e2323d5f0bb5 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 19 Aug 2016 17:52:53 +0200 Subject: [PATCH] Fix a refleak in call_method() Issue #27128. Fix a reference leak if creating the tuple to pass positional parameters fails. --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index ee0921ac00..00995d481d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1274,8 +1274,10 @@ call_method(PyObject *o, char *name, PyObject **nameobj, 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); -- 2.50.1