From: Victor Stinner Date: Fri, 19 Aug 2016 15:58:54 +0000 (+0200) Subject: Fix a refleak in call_maybe() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42e9d94bc5d7134461a03afe9526e0926ed223dc;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 00995d481d..950835c6b7 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1314,8 +1314,10 @@ call_maybe(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);