Skip to content

Commit

Permalink
m_callerid Free old extension data before unserializing the new data
Browse files Browse the repository at this point in the history
  • Loading branch information
attilamolnar committed Feb 13, 2016
1 parent 09c716c commit c6c6171
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/m_callerid.cpp
Expand Up @@ -68,7 +68,12 @@ struct CallerIDExtInfo : public ExtensionItem

void unserialize(SerializeFormat format, Extensible* container, const std::string& value)
{
void* old = get_raw(container);
if (old)
this->free(old);
callerid_data* dat = new callerid_data;
set_raw(container, dat);

irc::commasepstream s(value);
std::string tok;
if (s.GetToken(tok))
Expand All @@ -89,10 +94,6 @@ struct CallerIDExtInfo : public ExtensionItem
}
}
}

void* old = set_raw(container, dat);
if (old)
this->free(old);
}

callerid_data* get(User* user, bool create)
Expand Down

0 comments on commit c6c6171

Please sign in to comment.