mirror of
https://github.com/python/cpython.git
synced 2025-12-01 23:32:16 +00:00
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
This commit is contained in:
parent
3e700e4ca3
commit
0523c39e77
2 changed files with 2 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
||||||
|
Fix a possible reference leak in :func:`itertools.count`.
|
||||||
|
|
@ -4089,6 +4089,7 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
|
||||||
lz = (countobject *)type->tp_alloc(type, 0);
|
lz = (countobject *)type->tp_alloc(type, 0);
|
||||||
if (lz == NULL) {
|
if (lz == NULL) {
|
||||||
Py_XDECREF(long_cnt);
|
Py_XDECREF(long_cnt);
|
||||||
|
Py_DECREF(long_step);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
lz->cnt = cnt;
|
lz->cnt = cnt;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue