Automatic variable buffer, and realloc when it is necessary