Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d925bd5

Browse files
committed
Fix a refleak in call_method()
Issue #27128. Fix a reference leak if creating the tuple to pass positional parameters fails.
1 parent 53926f1 commit d925bd5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Objects/typeobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,10 @@ call_method(PyObject *o, _Py_Identifier *nameid, char *format, ...)
14321432

14331433
va_end(va);
14341434

1435-
if (args == NULL)
1435+
if (args == NULL) {
1436+
Py_DECREF(func);
14361437
return NULL;
1438+
}
14371439

14381440
assert(PyTuple_Check(args));
14391441
retval = PyObject_Call(func, args, NULL);

0 commit comments

Comments
 (0)