update the buffer pointer after possible relocation in realloc()