Author Topic: BUG: Memory leak at DebuggerManager::UnregisterDebugger  (Read 2891 times)

Offline lights_joy

  • Multiple posting newcomer
  • *
  • Posts: 13
BUG: Memory leak at DebuggerManager::UnregisterDebugger
« on: January 23, 2014, 04:06:10 pm »
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;

    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
before erase,  or there will be a memory leak.

I think the author may want to free all objects at the destructor:
    for (RegisteredPlugins::iterator it = m_registered.begin(); it != m_registered.end(); ++it)

    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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: BUG: Memory leak at DebuggerManager::UnregisterDebugger
« Reply #1 on: January 23, 2014, 09:57:07 pm »
Fixed in trunk...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]