]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_spanningtree Do pointer comparison before deleting one of the pointers in TreeSocke...
authorAttila Molnar <attilamolnar@hush.com>
Sun, 2 Mar 2014 16:04:51 +0000 (17:04 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Sun, 2 Mar 2014 16:04:51 +0000 (17:04 +0100)
While the previous code worked fine in practice, it was incorrect in theory

src/modules/m_spanningtree/treesocket1.cpp

index 7b233169dcca6a5569e9dd88c6e024157877183b..c9729cc0f3a6837c96d3d290b1e44c0ad8e9887b 100644 (file)
@@ -212,8 +212,9 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason)
                Current->Tidy();
                Current->GetParent()->DelChild(Current);
                Current->cull();
+               const bool ismyroot = (Current == MyRoot);
                delete Current;
-               if (Current == MyRoot)
+               if (ismyroot)
                {
                        MyRoot = NULL;
                        Close();