mirror of
https://github.com/python/cpython.git
synced 2025-12-05 00:52:25 +00:00
Fixed resource leak to scratch when _PyUnicodeWriter_Prepare fails
This commit is contained in:
parent
f03572d040
commit
110ac16b9f
1 changed files with 3 additions and 1 deletions
|
|
@ -1628,8 +1628,10 @@ long_to_decimal_string_internal(PyObject *aa,
|
||||||
strlen++;
|
strlen++;
|
||||||
}
|
}
|
||||||
if (writer) {
|
if (writer) {
|
||||||
if (_PyUnicodeWriter_Prepare(writer, strlen, '9') == -1)
|
if (_PyUnicodeWriter_Prepare(writer, strlen, '9') == -1) {
|
||||||
|
Py_DECREF(scratch);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
kind = writer->kind;
|
kind = writer->kind;
|
||||||
str = NULL;
|
str = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue