If the person in question is detained upon a criminal charge and it appears to the court that there is probable cause for his detention, he shall not be discharged for any defect in the affidavit, warrant, or commitment until a reasonable time has been given to the prosecutor to remedy the defect by a new proceeding.
OCGA § 9-14-17