Commit cceb68f2 authored by Ken Martin's avatar Ken Martin
Browse files

Remove memory leak caused by cmDynamicLoader not being deleted properly

parent b4310462
......@@ -77,8 +77,6 @@ bool cmDynamicLoaderCache::FlushCache(const char* path)
m_CacheMap.erase(it);
ret = true;
}
delete cmDynamicLoaderCache::Instance;
cmDynamicLoaderCache::Instance = 0;
return ret;
}
......@@ -89,7 +87,8 @@ void cmDynamicLoaderCache::FlushCache()
{
cmDynamicLoader::CloseLibrary(it->second);
}
m_CacheMap.erase(m_CacheMap.begin(), m_CacheMap.end());
delete cmDynamicLoaderCache::Instance;
cmDynamicLoaderCache::Instance = 0;
}
cmDynamicLoaderCache* cmDynamicLoaderCache::GetInstance()
......
......@@ -20,13 +20,25 @@
#include "cmake.h"
#include "cmListFileCache.h"
#include "cmCacheManager.h"
#include "cmDynamicLoader.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "windows.h"
#endif
int do_cmaketest(int ac, char** av);
int main(int ac, char** av)
{
int ret = do_cmaketest(ac, av);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
#endif
cmListFileCache::GetInstance()->ClearCache();
return ret;
}
// this is a test driver program for cmake.
int main (int argc, char **argv)
int do_cmaketest (int argc, char **argv)
{
if (argc < 4)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment