When an indictment is for a misdemeanor and the court is of opinion that the prosecution is frivolous or malicious, the prosecutor is liable for the costs.