Where a person, before indictment found against him, has been discharged or held to bail on habeas corpus by order of a court or judge of competent jurisdiction, he shall not be again imprisoned or detained in custody on an accusation for the same offense, until after he shall have been indicted, unless surrendered by his bail.
Tex. Code Crim. Proc. § 11.56