frees buffer when it's passed to init_buffer function