New York Laws
Article 3 - Privilege From Arrest
27 - Discharge of Exempt Witness.

ยง 27. Discharge of exempt witness. Where a person has been arrested in
violation of section twenty-five, a justice of the supreme court, a
county judge or the court, if any, from which the subpoena was issued or
which ordered the witness to attend, or a judge thereof, shall order
such person discharged from the arrest upon proof, by affidavit, of the
facts.