Fix `free_all_mem` and EXITFREE definition

Because of the '$' in `if(DEFINED $ENV{VALGRIND_CHECK})` EXITFREE wasn't being
defined, so the `free_all_mem` wasn't being included or called in the resulting
binary.

This commit fixes that, and also adds includes needed for `free_all_mem`
compilation.
Fix memory leak in `eval7`