]> granicus.if.org Git - python/commitdiff
Fix a refleak in call_maybe()
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 15:58:12 +0000 (17:58 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 15:58:12 +0000 (17:58 +0200)
Issue #27128. Fix a reference leak if creating the tuple to pass positional
parameters fails.

Objects/typeobject.c

index a78f328ca79d67180ede470a4054e326bafbe2cb..1181d77efd09cd159a8abd15b3805b39a3360e86 100644 (file)
@@ -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);