Commit c0dce6aa authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by Raymond Hettinger

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

(cherry picked from commit 0523c39e)
Co-authored-by: default avatarZackery Spytz <zspytz@gmail.com>
parent bd96393c
Fix a possible reference leak in :func:`itertools.count`.
...@@ -3321,6 +3321,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -3321,6 +3321,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
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