Fixed memory leak in ctest program