浏览代码

Fix mem leak reported by valgrind.

David Cole 16 年之前
父节点
当前提交
474cf519a0
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      Source/cmake.cxx

+ 3 - 3
Source/cmake.cxx

@@ -4397,7 +4397,7 @@ int cmake::Build(const std::string& dir,
                  const std::string& config,
                  const std::string& config,
                  const std::vector<std::string>& nativeOptions,
                  const std::vector<std::string>& nativeOptions,
                  bool clean)
                  bool clean)
-{ 
+{
   if(!cmSystemTools::FileIsDirectory(dir.c_str()))
   if(!cmSystemTools::FileIsDirectory(dir.c_str()))
     {
     {
     std::cerr << "Error: " << dir << " is not a directory\n";
     std::cerr << "Error: " << dir << " is not a directory\n";
@@ -4417,8 +4417,8 @@ int cmake::Build(const std::string& dir,
     std::cerr << "Error: could find generator in Cache\n";
     std::cerr << "Error: could find generator in Cache\n";
     return 1;
     return 1;
     }
     }
-  cmGlobalGenerator* gen =
-    this->CreateGlobalGenerator(it.GetValue());
+  std::auto_ptr<cmGlobalGenerator> gen(
+    this->CreateGlobalGenerator(it.GetValue()));
   std::string output;
   std::string output;
   std::string projName;
   std::string projName;
   std::string makeProgram;
   std::string makeProgram;