Cleaned up CMake to check for memory leaks and fail test if memory leak is found