Fixed SIGSEGV in ast.c

NULL lists were tried to be freed.
codegen.cpp: compilable
kldscp: compilable codegen()

Did not try to run it, though