Skip to content

Commit

Permalink
Propagate error when PyByteArray_Resize() fails in bytearray_translate()
Browse files Browse the repository at this point in the history
CID 715334
  • Loading branch information
tiran committed Jul 21, 2013
2 parents 8ded80d + c731bbe commit 6895947
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,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)
Expand Down

0 comments on commit 6895947

Please sign in to comment.