summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-09-19 09:55:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-09-19 09:55:44 (GMT)
commit26c03bd7d5892e6bd7304231c8f10955a73c854d (patch)
treeadf1d1d3450fe4e2d3a71db078cf9528715545d4
parent286987bbac8e6138c270ae8863f29a26d38ac977 (diff)
downloadcpython-26c03bd7d5892e6bd7304231c8f10955a73c854d.zip
cpython-26c03bd7d5892e6bd7304231c8f10955a73c854d.tar.gz
cpython-26c03bd7d5892e6bd7304231c8f10955a73c854d.tar.bz2
Fix memory leak in path_converter()
Issue #28200: Replace PyUnicode_AsWideCharString() with PyUnicode_AsUnicodeAndSize().
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/posixmodule.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index e26a5c0..0a021ea 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,9 @@ Core and Builtins
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 @@ path_converter(PyObject *o, void *p)
if (is_unicode) {
#ifdef MS_WINDOWS
- wide = PyUnicode_AsWideCharString(o, &length);
+ wide = PyUnicode_AsUnicodeAndSize(o, &length);
if (!wide) {
goto exit;
}