Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix reference leaks in various unusual error scenarios.
4 changes: 3 additions & 1 deletion Modules/itertoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3538,8 +3538,10 @@ count_nextlong(countobject *lz)
if (long_cnt == NULL) {
/* Switch to slow_mode */
long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
if (long_cnt == NULL)
if (long_cnt == NULL) {
return NULL;
}
lz->long_cnt = long_cnt;
}
assert(lz->cnt == PY_SSIZE_T_MAX && long_cnt != NULL);

Expand Down
1 change: 1 addition & 0 deletions Objects/enumobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ increment_longindex_lock_held(enumobject *en)
if (next_index == NULL) {
return NULL;
}
en->en_longindex = next_index;
}
assert(next_index != NULL);
PyObject *stepped_up = PyNumber_Add(next_index, en->one);
Expand Down
4 changes: 3 additions & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,9 @@ listiter_reduce_general(void *_it, int forward)
}
/* empty iterator, create an empty list */
list = PyList_New(0);
if (list == NULL)
if (list == NULL) {
Py_DECREF(iter);
return NULL;
}
return Py_BuildValue("N(N)", iter, list);
}
Loading