Fix bad memory access problems found by Miguel Sofer when valgrinding.
Fix memory leak in [format] compiler.
merge trunk