diff Objects/unicodeobject.c @ 78947:a3e194661b5f

Fixed memory leak in error branch of formatfloat(). CID 719687
author Christian Heimes <christian@cheimes.de>
date Mon, 10 Sep 2012 11:48:41 +0200
parents db34753bd70e
children 4f2811e5e462
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Mon Sep 10 03:50:48 2012 +0200
+++ b/Objects/unicodeobject.c	Mon Sep 10 11:48:41 2012 +0200
@@ -13238,8 +13238,10 @@
         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;
     }