Fix memory leak
Fix memory leak in test runner
Fix memory leak found by valgrind