]> granicus.if.org Git - python/commitdiff
Fix memory leak in path_converter()
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 19 Sep 2016 09:55:44 +0000 (11:55 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 19 Sep 2016 09:55:44 +0000 (11:55 +0200)
Issue #28200: Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().

Misc/NEWS
Modules/posixmodule.c

index e26a5c05abae1f3c061a59c5f75e7df1723bb375..0a021ea15577d32e73bc7571c89d3d96bb744952 100644 (file)
--- 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.
 
index ba54249684d085a9cadc71e7c29cd1b0ef3e9dc8..470ee92fa194b0247102aec3bf9913ee0678d912 100644 (file)
@@ -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;
         }