From ed08638c1afa2742f0ebc3006dd0f1054020f7d4 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 2 Mar 2014 17:04:51 +0100 Subject: 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 --- src/modules/m_spanningtree/treesocket1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); -- cgit v1.2.3