Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that a NEWS entry is needed since it's unlikely to hit the issue, users are not directly impacted.

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;
Comment thread
sergey-miryanov marked this conversation as resolved.
Outdated
}
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;
Comment thread
sergey-miryanov marked this conversation as resolved.
Outdated
}
assert(next_index != NULL);
Comment thread
eendebakpt marked this conversation as resolved.
Outdated
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