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