diff options
| author | Christian Heimes <christian@cheimes.de> | 2012-09-10 11:48:41 +0200 |
|---|---|---|
| committer | Christian Heimes <christian@cheimes.de> | 2012-09-10 11:48:41 +0200 |
| commit | f4f9939a96ed09cee5a73fd40a040e381dbdf6f1 (patch) | |
| tree | 7e5cd943756418194f0e2b144641bf632f9a3874 | |
| parent | 89ff3c7f20ef2451041f80350f4718e3e4e735a1 (diff) | |
| download | cpython-git-f4f9939a96ed09cee5a73fd40a040e381dbdf6f1.tar.gz | |
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 279516809f..2d74d1cca3 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; } |
