Issue #17051: Fix a memory leak in os.path.isdir() on Windows. Patch by Robert Xiao.
diff --git a/Misc/NEWS b/Misc/NEWS
index cd16670..31c4a8a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -200,6 +200,9 @@
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 d2742a0..776c7c6 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4229,6 +4229,7 @@
return NULL;
attributes = GetFileAttributesA(path);
+ PyMem_Free(path);
if (attributes == INVALID_FILE_ATTRIBUTES)
Py_RETURN_FALSE;