Rect: Fix some memory-management problems.