[PATCH openEuler-22.03-LTS-SP1] sh: push-switch: Reorder cleanup operations to avoid use-after-free bug