If any person is committed to prison, or is in custody of any officer on any criminal charge, by virtue of any warrant of commitment of a magistrate, such person must not be discharged on the ground of any mere defect of form in the warrant of commitment.