From 26c03bd7d5892e6bd7304231c8f10955a73c854d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 19 Sep 2016 11:55:44 +0200 Subject: [PATCH] Fix memory leak in path_converter() Issue #28200: Replace PyUnicode_AsWideCharString() with PyUnicode_AsUnicodeAndSize(). --- Misc/NEWS | 3 +++ Modules/posixmodule.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index e26a5c05ab..0a021ea155 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 ba54249684..470ee92fa1 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; } -- 2.40.0