diff options
author | Christian Heimes <christian@cheimes.de> | 2012-09-10 09:48:41 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2012-09-10 09:48:41 (GMT) |
commit | fd3023649459c5eac49f401335d43a9587da5e71 (patch) | |
tree | 9a611fb19fde9fbc743d586044a5554a5e2417c3 | |
parent | be232923e48630235da0939f5a47a3dd5908779f (diff) | |
download | cpython-fd3023649459c5eac49f401335d43a9587da5e71.zip cpython-fd3023649459c5eac49f401335d43a9587da5e71.tar.gz cpython-fd3023649459c5eac49f401335d43a9587da5e71.tar.bz2 |
Fixed memory leak in error branch of formatfloat(). CID 719687
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 6d49806..34a934d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13237,8 +13237,10 @@ formatfloat(PyObject *v, int flags, int prec, int type, return -1; len = strlen(p); if (writer) { - if (_PyUnicodeWriter_Prepare(writer, len, 127) == -1) + if (_PyUnicodeWriter_Prepare(writer, len, 127) == -1) { + PyMem_Free(p); return -1; + } unicode_write_cstr(writer->buffer, writer->pos, p, len); writer->pos += len; } |