summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/bytearrayobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 9f1cf0a..60b2811 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1506,7 +1506,10 @@ bytearray_translate(PyByteArrayObject *self, PyObject *args)
}
/* Fix the size of the resulting string */
if (inlen > 0)
- PyByteArray_Resize(result, output - output_start);
+ if (PyByteArray_Resize(result, output - output_start) < 0) {
+ Py_CLEAR(result);
+ goto done;
+ }
done:
if (tableobj != NULL)