fixed double buffer_free()