Fix parser memory leaks