Remove memory leak caused by cmDynamicLoader not being deleted properly

This commit is contained in:
Ken Martin 2002-10-09 17:47:24 -04:00
parent b431046277
commit cceb68f2a0
2 changed files with 15 additions and 4 deletions

View File

@ -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()

View File

@ -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)
{