summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 09:48:41 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 09:48:41 (GMT)
commitf4f9939a96ed09cee5a73fd40a040e381dbdf6f1 (patch)
tree7e5cd943756418194f0e2b144641bf632f9a3874 /Objects
parent89ff3c7f20ef2451041f80350f4718e3e4e735a1 (diff)
downloadcpython-f4f9939a96ed09cee5a73fd40a040e381dbdf6f1.zip
cpython-f4f9939a96ed09cee5a73fd40a040e381dbdf6f1.tar.gz
cpython-f4f9939a96ed09cee5a73fd40a040e381dbdf6f1.tar.bz2
Fixed memory leak in error branch of formatfloat(). CID 719687
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 2795168..2d74d1c 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;
}