Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26c03bd

Browse files
committed
Fix memory leak in path_converter()
Issue #28200: Replace PyUnicode_AsWideCharString() with PyUnicode_AsUnicodeAndSize().
1 parent 286987b commit 26c03bd

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Core and Builtins
2929
Library
3030
-------
3131

32+
- Issue #28200: Fix memory leak on Windows in the os module (fix
33+
path_converter() function).
34+
3235
- Issue #25400: RobotFileParser now correctly returns default values for
3336
crawl_delay and request_rate. Initial patch by Peter Wirtz.
3437

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ path_converter(PyObject *o, void *p)
920920

921921
if (is_unicode) {
922922
#ifdef MS_WINDOWS
923-
wide = PyUnicode_AsWideCharString(o, &length);
923+
wide = PyUnicode_AsUnicodeAndSize(o, &length);
924924
if (!wide) {
925925
goto exit;
926926
}

0 commit comments

Comments
 (0)