Skip to content

Commit f9dac4e

Browse files
authored
gh-145376: Avoid reference leaks in failure path of _functoolsmodule.c method partial_new (GH-145423)
1 parent 3fe7849 commit f9dac4e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/_functoolsmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
252252
}
253253
PyObject *item;
254254
PyObject *tot_args = PyTuple_New(tot_nargs);
255+
if (tot_args == NULL) {
256+
Py_DECREF(new_args);
257+
Py_DECREF(pto);
258+
return NULL;
259+
}
255260
for (Py_ssize_t i = 0, j = 0; i < tot_nargs; i++) {
256261
if (i < npargs) {
257262
item = PyTuple_GET_ITEM(pto_args, i);

0 commit comments

Comments
 (0)