mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Fixed memory leak in error branch of formatfloat(). CID 719687
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user