Use xrealloc() instead of realloc()