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

Objects/typeobject.c

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