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

This commit is contained in:
Zackery Spytz 2019-03-26 00:05:29 -06:00 committed by Serhiy Storchaka
parent 3e700e4ca3
commit 0523c39e77
2 changed files with 2 additions and 0 deletions

View File

@ -0,0 +1 @@
Fix a possible reference leak in :func:`itertools.count`.

View File

@ -4089,6 +4089,7 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
lz = (countobject *)type->tp_alloc(type, 0);
if (lz == NULL) {
Py_XDECREF(long_cnt);
Py_DECREF(long_step);
return NULL;
}
lz->cnt = cnt;