added the failure condition for realloc