shorten: check for realloc failure