mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #15728: Fix leak in PyUnicode_AsWideCharString(). Found by Coverity.
This commit is contained in:
parent
a19de803e4
commit
8528c3145e
1 changed files with 3 additions and 1 deletions
|
@ -2935,8 +2935,10 @@ PyUnicode_AsWideCharString(PyObject *unicode,
|
|||
return NULL;
|
||||
}
|
||||
buflen = unicode_aswidechar(unicode, buffer, buflen);
|
||||
if (buflen == -1)
|
||||
if (buflen == -1) {
|
||||
PyMem_FREE(buffer);
|
||||
return NULL;
|
||||
}
|
||||
if (size != NULL)
|
||||
*size = buflen;
|
||||
return buffer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue