fixed memory leak
This commit is contained in:
parent
72054b95fd
commit
9878f49dfc
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue