summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-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;
}