summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-03-02 17:04:51 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-03-02 17:04:51 +0100
commited08638c1afa2742f0ebc3006dd0f1054020f7d4 (patch)
treebb7bfb8c42e06531f36ab5d70a9001f73bd22bfb
parent473f3d3b2f973a1d746aa456dd874e4094ac9388 (diff)
m_spanningtree Do pointer comparison before deleting one of the pointers in TreeSocket::Squit()
While the previous code worked fine in practice, it was incorrect in theory
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 7b233169d..c9729cc0f 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -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();