diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-08-10 15:15:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-08-10 15:15:19 (GMT) |
commit | 8b07c96090135f541163b31d35f42f9034387e99 (patch) | |
tree | 163febd73289e1169aac1b208a99181eed0a68ee | |
parent | 40e55ab780428e132c06fb079c9cdf4865cb39d8 (diff) | |
download | CMake-8b07c96090135f541163b31d35f42f9034387e99.zip CMake-8b07c96090135f541163b31d35f42f9034387e99.tar.gz CMake-8b07c96090135f541163b31d35f42f9034387e99.tar.bz2 |
ENH: fix memory leak
-rw-r--r-- | Source/cmake.cxx | 8 |
1 files 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<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName)); + if (ggd.get()) { // Check the dependencies in case source files were removed. std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); - lgd->SetGlobalGenerator(ggd); + lgd->SetGlobalGenerator(ggd.get()); lgd->CheckDependencies(mf, verbose, this->ClearBuildSystem); // Check for multiple output pairs. |