jpeglsnec: fix memleak of state in error case