Fix memory leak in path_converter()
Issue #28200: Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().
diff --git a/Misc/NEWS b/Misc/NEWS
index e26a5c0..0a021ea 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,9 @@
Library
-------
+- Issue #28200: Fix memory leak on Windows in the os module (fix
+ path_converter() function).
+
- Issue #25400: RobotFileParser now correctly returns default values for
crawl_delay and request_rate. Initial patch by Peter Wirtz.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ba54249..470ee92 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -920,7 +920,7 @@
if (is_unicode) {
#ifdef MS_WINDOWS
- wide = PyUnicode_AsWideCharString(o, &length);
+ wide = PyUnicode_AsUnicodeAndSize(o, &length);
if (!wide) {
goto exit;
}