Commit 0523c39e authored by Zackery Spytz's avatar Zackery Spytz Committed by Serhiy Storchaka

bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)

parent 3e700e4c
Fix a possible reference leak in :func:`itertools.count`.
...@@ -4089,6 +4089,7 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt, ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment