mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-07 15:18:38 -06:00
fixed memory leak
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user