From: Raymond Hettinger Date: Tue, 16 Sep 2003 05:29:50 +0000 (+0000) Subject: Backport Neal's fix for bug #789402 -- a memory leak in fileobject.c X-Git-Tag: v2.3.1~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ae2511c06efd4e75cd6c8553300f8e4627551ac;p=thirdparty%2FPython%2Fcpython.git Backport Neal's fix for bug #789402 -- a memory leak in fileobject.c --- diff --git a/Misc/NEWS b/Misc/NEWS index c60771af2ba6..7912ae4ab5bb 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ What's New in Python 2.3.1? Core and builtins ----------------- +- Bug #789402, fixed memory leak when opening a file object. + - Fixed a leak when new code objects are instantiated. - Bug #800796: slice(1).__hash__() now raises a TypeError, unhashable type. diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 3e41704dcf00..6a2b5fb9c582 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -99,6 +99,7 @@ dircheck(PyFileObject* f) PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)", EISDIR, msg); PyErr_SetObject(PyExc_IOError, exc); + Py_XDECREF(exc); return NULL; } #endif