If a judgment against the defendant is reversed, such reversal shall be deemed an order for a new trial, unless the appellate court shall otherwise direct. If the appellate court directs a final disposition of the action in the defendant's favor, the court must, if he is in custody, direct him to be discharged therefrom; or if on bail that his bail may be exonerated; or if money or other property was deposited instead of bail, that it be refunded to the defendant or to the person or persons found by the court to have deposited said money or other property on behalf of said defendant. If a judgment against the defendant is reversed and the case is dismissed, or if the appellate court directs a final disposition of the action in defendant's favor, and defendant has theretofore paid a fine in the case, such act shall also be deemed an order of the court that the fine, including any penalty assessment thereon, be returned to defendant.
Ca. Pen. Code § 1262