Fixes a memory leak in mktest.
Fixes the regression test when running in valgrind.