From: Raymond Hettinger Date: Tue, 4 Mar 2008 22:29:44 +0000 (+0000) Subject: Fix refleak in chain(). X-Git-Tag: v2.6a2~394 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1cca2b59367c738a18617e4c4552f208ac8f5c2;p=thirdparty%2FPython%2Fcpython.git Fix refleak in chain(). --- diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 76c848491d0d..d8e14d0dcee5 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -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 */ }