From: Neal Norwitz Date: Fri, 15 Aug 2003 20:05:45 +0000 (+0000) Subject: Fix SF #789402, Memory leak on open() X-Git-Tag: v2.4a1~1731 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98cad48171dd760e2d05fde320e87dad42bd5399;p=python Fix SF #789402, Memory leak on open() If opening a directory, the exception would leak. --- diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 1cc6def62c..13354c8839 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