Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Side by Side Diff: Modules/posixmodule.c

Issue 28200: Windows: path_converter() leaks memory for Unicode filenames
Patch Set: Created 3 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* POSIX module implementation */ 2 /* POSIX module implementation */
3 3
4 /* This file is also used for Windows NT/MS-Win. In that case the 4 /* This file is also used for Windows NT/MS-Win. In that case the
5 module actually calls itself 'nt', not 'posix', and a few 5 module actually calls itself 'nt', not 'posix', and a few
6 functions are either unimplemented or implemented differently. The source 6 functions are either unimplemented or implemented differently. The source
7 assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent 7 assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent
8 of the compiler used. Different compilers define their own feature 8 of the compiler used. Different compilers define their own feature
9 test macro, e.g. '_MSC_VER'. */ 9 test macro, e.g. '_MSC_VER'. */
10 10
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 else if (PyBytes_Check(o)) { 913 else if (PyBytes_Check(o)) {
914 is_bytes = 1; 914 is_bytes = 1;
915 } 915 }
916 else { 916 else {
917 goto error_exit; 917 goto error_exit;
918 } 918 }
919 } 919 }
920 920
921 if (is_unicode) { 921 if (is_unicode) {
922 #ifdef MS_WINDOWS 922 #ifdef MS_WINDOWS
923 wide = PyUnicode_AsWideCharString(o, &length); 923 wide = PyUnicode_AsUnicodeAndSize(o, &length);
924 if (!wide) { 924 if (!wide) {
925 goto exit; 925 goto exit;
926 } 926 }
927 if (length > 32767) { 927 if (length > 32767) {
928 FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows"); 928 FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
929 goto exit; 929 goto exit;
930 } 930 }
931 if (wcslen(wide) != length) { 931 if (wcslen(wide) != length) {
932 FORMAT_EXCEPTION(PyExc_ValueError, "embedded null character in %s"); 932 FORMAT_EXCEPTION(PyExc_ValueError, "embedded null character in %s");
933 goto exit; 933 goto exit;
(...skipping 12133 matching lines...) Expand 10 before | Expand all | Expand 10 after
13067 PyModule_AddObject(m, "DirEntry", (PyObject *)&DirEntryType); 13067 PyModule_AddObject(m, "DirEntry", (PyObject *)&DirEntryType);
13068 13068
13069 initialized = 1; 13069 initialized = 1;
13070 13070
13071 return m; 13071 return m;
13072 } 13072 }
13073 13073
13074 #ifdef __cplusplus 13074 #ifdef __cplusplus
13075 } 13075 }
13076 #endif 13076 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+