From: Christian Heimes Date: Mon, 10 Sep 2012 09:48:41 +0000 (+0200) Subject: Fixed memory leak in error branch of formatfloat(). CID 719687 X-Git-Tag: v3.3.1rc1~818^2^2~108 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f4f9939a96ed09cee5a73fd40a040e381dbdf6f1;p=thirdparty%2FPython%2Fcpython.git Fixed memory leak in error branch of formatfloat(). CID 719687 --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 279516809f98..2d74d1cca3bb 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13238,8 +13238,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; }