[PATCH 6.5 175/285] sh: push-switch: Reorder cleanup operations to avoid use-after-free bug