Fix memory leak in compiler

When compilation would fail due to a syntax error for example, all
memory wasn't properly freed for the parser state.