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

Skip to content

Commit 6f8eeee

Browse files
committed
Issue #18203: Fix _Py_DecodeUTF8_surrogateescape(), use PyMem_RawMalloc() as _Py_char2wchar()
1 parent fa535f5 commit 6f8eeee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4806,7 +4806,7 @@ PyUnicode_DecodeUTF8Stateful(const char *s,
48064806
used to decode the command line arguments on Mac OS X.
48074807
48084808
Return a pointer to a newly allocated wide character string (use
4809-
PyMem_Free() to free the memory), or NULL on memory allocation error. */
4809+
PyMem_RawFree() to free the memory), or NULL on memory allocation error. */
48104810

48114811
wchar_t*
48124812
_Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
@@ -4819,7 +4819,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
48194819
character count */
48204820
if (PY_SSIZE_T_MAX / sizeof(wchar_t) < (size + 1))
48214821
return NULL;
4822-
unicode = PyMem_Malloc((size + 1) * sizeof(wchar_t));
4822+
unicode = PyMem_RawMalloc((size + 1) * sizeof(wchar_t));
48234823
if (!unicode)
48244824
return NULL;
48254825

0 commit comments

Comments
 (0)