Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
BUG: Memory leak at DebuggerManager::UnregisterDebugger
(1/1)
lights_joy:
i'm using c::b 13.12, in the function
bool DebuggerManager::UnregisterDebugger(cbDebuggerPlugin *plugin)
{
RegisteredPlugins::iterator it = m_registered.find(plugin);
if(it == m_registered.end())
return false;
m_registered.erase(it);
......
return true;
}
here just erase the PluginData from the vector, but this operation will NOT free the content of PluginData::m_configurations (there's at least one cbDebuggerConfiguration* object),
so I think it's better to call
it->second.ClearConfigurations();
before erase, or there will be a memory leak.
I think the author may want to free all objects at the destructor:
DebuggerManager::~DebuggerManager()
{
for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)
it->second.ClearConfigurations();
delete m_interfaceFactory;
}
in fact, every cbDebuggerPlugin will call UnregisterDebugger first and when the DebuggerManager's destructor is called, there is nothing in the m_registered vector,
so the code in the destructor is useless.
oBFusCATed:
Fixed in trunk...
Navigation
[0] Message Index
Go to full version