Fix memory leak in path_converter()

Issue #28200: Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().
This commit is contained in:
Victor Stinner 2016-09-19 11:55:44 +02:00
parent 286987bbac
commit 26c03bd7d5
2 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,9 @@ Core and Builtins
Library 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 - Issue #25400: RobotFileParser now correctly returns default values for
crawl_delay and request_rate. Initial patch by Peter Wirtz. crawl_delay and request_rate. Initial patch by Peter Wirtz.

View File

@ -920,7 +920,7 @@ path_converter(PyObject *o, void *p)
if (is_unicode) { if (is_unicode) {
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
wide = PyUnicode_AsWideCharString(o, &length); wide = PyUnicode_AsUnicodeAndSize(o, &length);
if (!wide) { if (!wide) {
goto exit; goto exit;
} }