diff options
author | Brad King <brad.king@kitware.com> | 2016-05-26 13:52:09 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-05-26 13:52:09 (GMT) |
commit | 67cc866877287743bc0aa725ad9d3298d8ccc3dd (patch) | |
tree | 03efbb55c1d79fc00743ea81b904cdee3dd2f991 /Source | |
parent | 579185be7aa0425f61e4e3672284d16787044757 (diff) | |
parent | 75e3e0d3dcd7d17a45e2d00148b496013423d210 (diff) | |
download | CMake-67cc866877287743bc0aa725ad9d3298d8ccc3dd.zip CMake-67cc866877287743bc0aa725ad9d3298d8ccc3dd.tar.gz CMake-67cc866877287743bc0aa725ad9d3298d8ccc3dd.tar.bz2 |
Merge topic 'fix-variable-watch-leak'
75e3e0d3 cmVariableWatch: Fix potential memory leak
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVariableWatch.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
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; } |