0
0
mirror of https://github.com/python/cpython.git synced 2024-12-01 11:15:56 +01:00

Fix refleaks if Py_EnterRecursiveCall() fails

Issue #29306: Destroy argstuple and kwdict if Py_EnterRecursiveCall() fails.
This commit is contained in:
Victor Stinner 2017-02-08 12:57:09 +01:00
parent 17a63e2169
commit 620580f280

View File

@ -2350,14 +2350,15 @@ _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
Py_DECREF(argstuple);
return NULL;
}
result = (*call)(callable, argstuple, kwargs);
Py_LeaveRecursiveCall();
Py_DECREF(argstuple);
result = _Py_CheckFunctionResult(callable, result, NULL);
return result;
}
@ -2544,6 +2545,8 @@ _PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t narg
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
Py_DECREF(argstuple);
Py_XDECREF(kwdict);
return NULL;
}