From 8b07c96090135f541163b31d35f42f9034387e99 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 10 Aug 2007 11:15:19 -0400 Subject: ENH: fix memory leak --- Source/cmake.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8e7179e..52f2ef0 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. -- cgit v0.12