Skip to content

Commit c2661e6

Browse files
authored
gh-151845: Fix formatfloat() return-value contract in unicode_format.c (#151846)
Fix formatfloat() return-value contract in unicode_format.c
1 parent f28ef85 commit c2661e6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Objects/unicode_format.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,13 @@ formatfloat(PyObject *v,
159159
return -1;
160160
}
161161
}
162-
else
162+
else {
163163
*p_output = _PyUnicode_FromASCII(p, len);
164+
if (*p_output == NULL) {
165+
PyMem_Free(p);
166+
return -1;
167+
}
168+
}
164169
PyMem_Free(p);
165170
return 0;
166171
}

0 commit comments

Comments
 (0)