diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-09-24 17:24:10 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-09-24 17:24:10 (GMT) |
commit | 9878f49dfcf6424ec50e5b9b3c46e8755a1e81fa (patch) | |
tree | c6593fffe4ff076b151fc2014ff5192c466a013d /Source | |
parent | 72054b95fdac6013a042cfee433eb474757a1450 (diff) | |
download | CMake-9878f49dfcf6424ec50e5b9b3c46e8755a1e81fa.zip CMake-9878f49dfcf6424ec50e5b9b3c46e8755a1e81fa.tar.gz CMake-9878f49dfcf6424ec50e5b9b3c46e8755a1e81fa.tar.bz2 |
fixed memory leak
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmake.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9042b4a..da5eef9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -78,6 +78,13 @@ cmCommand *cmake::GetCommand(const char *name) void cmake::AddCommand(cmCommand* wg) { std::string name = wg->GetName(); + // if the command already exists, free the old one + RegisteredCommandsMap::iterator pos = m_Commands.find(name); + if (pos != m_Commands.end()) + { + delete pos->second; + m_Commands.erase(pos); + } m_Commands.insert( RegisteredCommandsMap::value_type(name, wg)); } |