Skip to content

Commit 89fa05f

Browse files
encukouEclips4
andauthored
gh-122234: Add DECREFs to error paths (#122406)
Co-Authored-By: Kirill Podoprigora <[email protected]>
1 parent 9187484 commit 89fa05f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Python/bltinmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,8 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
26942694
continue;
26952695
}
26962696
else {
2697+
Py_DECREF(item);
2698+
Py_DECREF(iter);
26972699
return NULL;
26982700
}
26992701
}
@@ -2745,6 +2747,8 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
27452747
continue;
27462748
}
27472749
else {
2750+
Py_DECREF(item);
2751+
Py_DECREF(iter);
27482752
return NULL;
27492753
}
27502754
}

0 commit comments

Comments
 (0)