summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-02-13 19:30:05 +0100
committerAttila Molnar <attilamolnar@hush.com>2016-02-13 19:30:05 +0100
commitc6c61719b5a627ae68110ca4370a39bcfc4ff733 (patch)
tree2afec980f96fe54d7671a20447a95a0af735821f
parent09c716ce117e3c89b4da7ab88f4caaefb43511b5 (diff)
m_callerid Free old extension data before unserializing the new data
-rw-r--r--src/modules/m_callerid.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 4147f0b16..2df6d7af0 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -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))
@@ -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)