[Python-checkins] cpython: Issue #15728: Fix leak in PyUnicode_AsWideCharString(). Found by Coverity.
stefan.krah
python-checkins at python.org
Sun Aug 19 21:58:34 CEST 2012
http://hg.python.org/cpython/rev/2703171ddf53
changeset: 78657:2703171ddf53
user: Stefan Krah <skrah at bytereef.org>
date: Sun Aug 19 21:52:43 2012 +0200
summary:
Issue #15728: Fix leak in PyUnicode_AsWideCharString(). Found by Coverity.
files:
Objects/unicodeobject.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2935,8 +2935,10 @@
return NULL;
}
buflen = unicode_aswidechar(unicode, buffer, buflen);
- if (buflen == -1)
- return NULL;
+ if (buflen == -1) {
+ PyMem_FREE(buffer);
+ return NULL;
+ }
if (size != NULL)
*size = buflen;
return buffer;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list