]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_callerid Free old extension data before unserializing the new data
authorAttila Molnar <attilamolnar@hush.com>
Sat, 13 Feb 2016 18:30:05 +0000 (19:30 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Sat, 13 Feb 2016 18:30:05 +0000 (19:30 +0100)
src/modules/m_callerid.cpp

index 4147f0b161f57a4453ea9eb3c040173d19a10576..2df6d7af0cdb46c9a3c42b160bbe266ce69057aa 100644 (file)
@@ -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)