fix leaks in parser