summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/longobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 80fe724..7e12b34 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1628,8 +1628,10 @@ long_to_decimal_string_internal(PyObject *aa,
strlen++;
}
if (writer) {
- if (_PyUnicodeWriter_Prepare(writer, strlen, '9') == -1)
+ if (_PyUnicodeWriter_Prepare(writer, strlen, '9') == -1) {
+ Py_DECREF(scratch);
return -1;
+ }
kind = writer->kind;
str = NULL;
}