Handle errors from malloc() and calloc().
