make buffer_free inline