]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 26 Mar 2019 06:26:42 +0000 (23:26 -0700)
committerGitHub <noreply@github.com>
Tue, 26 Mar 2019 06:26:42 +0000 (23:26 -0700)
(cherry picked from commit 0523c39e7720b82b38ad793d3f1a5681adcdf873)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2019-03-25-23-37-26.bpo-36430.sd9xxQ.rst [new file with mode: 0644]
Modules/itertoolsmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-25-23-37-26.bpo-36430.sd9xxQ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-25-23-37-26.bpo-36430.sd9xxQ.rst
new file mode 100644 (file)
index 0000000..a65ee09
--- /dev/null
@@ -0,0 +1 @@
+Fix a possible reference leak in :func:`itertools.count`.
index 1113fb6b76c03d1717dcc2cc1782029c011ecf04..bff9df608304b67a69acb4c7d61d242f63be0a17 100644 (file)
@@ -4027,6 +4027,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     lz = (countobject *)type->tp_alloc(type, 0);
     if (lz == NULL) {
         Py_XDECREF(long_cnt);
+        Py_DECREF(long_step);
         return NULL;
     }
     lz->cnt = cnt;