Remove memory leak caused by cmDynamicLoader not being deleted properly
This commit is contained in:
parent
b431046277
commit
cceb68f2a0
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue