You don't need a grow buffer, this doubles what a normal realloc implementation does and this code is also not performance sensitive.