From: Victor Stinner Date: Fri, 19 Aug 2016 15:58:12 +0000 (+0200) Subject: Fix a refleak in call_maybe() X-Git-Tag: v3.6.0b1~653^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6902ddf2cab4900fa01248c313e7d4a7e67d97f7;p=python Fix a refleak in call_maybe() 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 a78f328ca7..1181d77efd 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1470,8 +1470,10 @@ call_maybe(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);