Don't forget that reallocating a pointer may fail