A person discharged from custody in a habeas corpus proceeding may be rearrested if a legal ground exists therefor.