[Python-checkins] cpython (3.6): Fix memory leak in path_converter()

victor.stinner python-checkins at python.org
Mon Sep 19 05:56:20 EDT 2016


https://hg.python.org/cpython/rev/6232e610e310
changeset: 103956:6232e610e310
branch: 3.6
parent: 103954:c1d9052996f1
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Sep 19 11:55:44 2016 +0200
summary:
 Fix memory leak in path_converter()
Issue #28200: Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().
files:
 Misc/NEWS | 3 +++
 Modules/posixmodule.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- 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
--- 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;
 }
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /