gh-145376: Avoid reference leaks in failure path of _functoolsmodule.c method partial_new (GH-145423)

This commit is contained in:
Pieter Eendebak 2026-03-04 14:32:14 +01:00 committed by GitHub
parent 3fe7849d9a
commit f9dac4e2eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -252,6 +252,11 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
}
PyObject *item;
PyObject *tot_args = PyTuple_New(tot_nargs);
if (tot_args == NULL) {
Py_DECREF(new_args);
Py_DECREF(pto);
return NULL;
}
for (Py_ssize_t i = 0, j = 0; i < tot_nargs; i++) {
if (i < npargs) {
item = PyTuple_GET_ITEM(pto_args, i);