From: Victor Stinner Date: Fri, 19 Aug 2016 15:51:49 +0000 (+0200) Subject: Fix a refleak in call_method() X-Git-Tag: v3.6.0b1~655^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d925bd5794e46e0952677ecdd6bf620bcbc719ae;p=python Fix a refleak in call_method() Issue #27128. Fix a reference leak if creating the tuple to pass positional parameters fails. --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9f57a7e637..a78f328ca7 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);