]> granicus.if.org Git - python/commitdiff
Fix refleak in chain().
authorRaymond Hettinger <python@rcn.com>
Tue, 4 Mar 2008 22:29:44 +0000 (22:29 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 4 Mar 2008 22:29:44 +0000 (22:29 +0000)
Modules/itertoolsmodule.c

index 76c848491d0dd7738ad44662b81a1a2e706a6470..d8e14d0dcee58f152e4b638a86714dc9c882eae6 100644 (file)
@@ -1682,8 +1682,8 @@ chain_next(chainobject *lz)
                        return NULL;                    /* no more input sources */
                }
                lz->active = PyObject_GetIter(iterable);
+               Py_DECREF(iterable);
                if (lz->active == NULL) {
-                       Py_DECREF(iterable);
                        Py_CLEAR(lz->source);
                        return NULL;                    /* input not iterable */
                }