Attempt to fix some minor memory leaks
parent
94f1ab4da3
commit
c0530921ff
|
@ -537,6 +537,14 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
|
||||||
Connection::~Connection()
|
Connection::~Connection()
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
|
// Delete peers
|
||||||
|
for(core::map<u16, Peer*>::Iterator
|
||||||
|
j = m_peers.getIterator();
|
||||||
|
j.atEnd() == false; j++)
|
||||||
|
{
|
||||||
|
Peer *peer = j.getNode()->getValue();
|
||||||
|
delete peer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal stuff */
|
/* Internal stuff */
|
||||||
|
|
|
@ -290,8 +290,11 @@ public:
|
||||||
// Ensure that the "" item (the hand) always has ToolCapabilities
|
// Ensure that the "" item (the hand) always has ToolCapabilities
|
||||||
if(def.name == "")
|
if(def.name == "")
|
||||||
assert(def.tool_capabilities != NULL);
|
assert(def.tool_capabilities != NULL);
|
||||||
|
|
||||||
m_item_definitions[def.name] = new ItemDefinition(def);
|
if(m_item_definitions.count(def.name) == 0)
|
||||||
|
m_item_definitions[def.name] = new ItemDefinition(def);
|
||||||
|
else
|
||||||
|
*(m_item_definitions[def.name]) = def;
|
||||||
|
|
||||||
// Remove conflicting alias if it exists
|
// Remove conflicting alias if it exists
|
||||||
bool alias_removed = (m_aliases.erase(def.name) != 0);
|
bool alias_removed = (m_aliases.erase(def.name) != 0);
|
||||||
|
|
Loading…
Reference in New Issue