ENH: fix memory leak

This commit is contained in:
Bill Hoffman 2007-08-10 11:15:19 -04:00
parent 40e55ab780
commit 8b07c96090
1 changed files with 5 additions and 3 deletions

View File

@ -2406,12 +2406,14 @@ int cmake::CheckBuildSystem()
{ {
genName = "Unix Makefiles"; genName = "Unix Makefiles";
} }
cmGlobalGenerator *ggd = this->CreateGlobalGenerator(genName); // this global generator is never set to the cmake object so it is never
if (ggd) // deleted, so make it an auto_ptr
std::auto_ptr<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName));
if (ggd.get())
{ {
// Check the dependencies in case source files were removed. // Check the dependencies in case source files were removed.
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd); lgd->SetGlobalGenerator(ggd.get());
lgd->CheckDependencies(mf, verbose, this->ClearBuildSystem); lgd->CheckDependencies(mf, verbose, this->ClearBuildSystem);
// Check for multiple output pairs. // Check for multiple output pairs.