The court shall order the defendant discharged from custody or bail, as to that charge, when it sustains a motion to quash based upon the ground that:
In other cases, when a motion to quash is sustained, the court may order that the defendant be held in custody or that his bail be continued for a specified time, pending the filing of a new indictment.
La. Cr.P. § 538