[Cmake-commits] CMake branch, next, updated. v3.5.2-1581-g7af18cb

Brad King brad.king at kitware.com
Wed May 25 10:00:40 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  7af18cb57b3d8d3366c694d57fa7f6888f45e9dc (commit)
       via  75e3e0d3dcd7d17a45e2d00148b496013423d210 (commit)
      from  dc857f961d48c6a03eb2b0cafc38b8e69629075b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7af18cb57b3d8d3366c694d57fa7f6888f45e9dc
commit 7af18cb57b3d8d3366c694d57fa7f6888f45e9dc
Merge: dc857f9 75e3e0d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed May 25 10:00:40 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed May 25 10:00:40 2016 -0400

    Merge topic 'fix-variable-watch-leak' into next
    
    75e3e0d3 cmVariableWatch: Fix potential memory leak


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75e3e0d3dcd7d17a45e2d00148b496013423d210
commit 75e3e0d3dcd7d17a45e2d00148b496013423d210
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed May 25 09:58:36 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed May 25 09:58:36 2016 -0400

    cmVariableWatch: Fix potential memory leak
    
    Teach cmVariableWatch::AddWatch to own the Pair it allocates until
    it needs to pass ownership to WatchMap.

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index ac2f2fa..11eaa93 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -13,6 +13,8 @@
 
 #include "cmAlgorithms.h"
 
+#include <cmsys/auto_ptr.hxx>
+
 static const char* const cmVariableWatchAccessStrings[] = {
   "READ_ACCESS",     "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
   "MODIFIED_ACCESS", "REMOVED_ACCESS",      "NO_ACCESS"
@@ -46,7 +48,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
                                void* client_data /*=0*/,
                                DeleteData delete_data /*=0*/)
 {
-  cmVariableWatch::Pair* p = new cmVariableWatch::Pair;
+  cmsys::auto_ptr<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
   p->Method = method;
   p->ClientData = client_data;
   p->DeleteDataCall = delete_data;
@@ -60,7 +62,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
       return false;
     }
   }
-  vp->push_back(p);
+  vp->push_back(p.release());
   return true;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 Source/cmVariableWatch.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list