path: Factor out deallocation