Check return value from realloc call (Jim Meyering).