commit | 8528c3145e5856a88199f07e155b3c75710cc2a1 | [log] [tgz] |
---|---|---|
author | Stefan Krah <skrah@bytereef.org> | Sun Aug 19 21:52:43 2012 +0200 |
committer | Stefan Krah <skrah@bytereef.org> | Sun Aug 19 21:52:43 2012 +0200 |
tree | e9c3fe1341d9888cc06f4f99e0e8ccfcfa268419 | |
parent | a19de803e4661af947938df2db72d0cd5538f4a4 [diff] [blame] |
Issue #15728: Fix leak in PyUnicode_AsWideCharString(). Found by Coverity.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index d369861..773a9be 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c
@@ -2935,8 +2935,10 @@ 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;