From 46f5b35bc0d680501629f75a86e40ee4b5798ed7 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 28 Jan 2013 20:19:50 +0200 Subject: [PATCH] =?UTF-8?q?Issue=20#17051:=20Fix=20a=20memory=20leak=20in?= =?UTF-8?q?=20os.path.isdir()=C2=A0on=20Windows.=20Patch=20by=20Robert=20X?= =?UTF-8?q?iao.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS | 3 +++ Modules/posixmodule.c | 1 + 2 files changed, 4 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index cd166702228..31c4a8a6c82 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,9 @@ Core and Builtins Library ------- +- Issue #17051: Fix a memory leak in os.path.isdir() on Windows. Patch by + Robert Xiao. + - Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase interface and support all mandatory methods and properties. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d2742a0ee15..776c7c6fb66 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4229,6 +4229,7 @@ posix__isdir(PyObject *self, PyObject *args) return NULL; attributes = GetFileAttributesA(path); + PyMem_Free(path); if (attributes == INVALID_FILE_ATTRIBUTES) Py_RETURN_FALSE;