A person acquitted by the jury upon the facts and merits on a former trial may plead such acquittal in bar of a second prosecution for the same offense, notwithstanding any defect in the form or substance of the indictment or accusation on which he was acquitted.