Skip to content

Commit f5119a5

Browse files
miss-islingtonaisk
andauthored
[3.15] gh-151845: Fix formatfloat() return-value contract in unicode_format.c (GH-151846) (#151865)
gh-151845: Fix formatfloat() return-value contract in unicode_format.c (GH-151846) Fix formatfloat() return-value contract in unicode_format.c (cherry picked from commit c2661e6) Co-authored-by: AN Long <aisk@users.noreply.github.com>
1 parent f43f438 commit f5119a5

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)