]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2750] Handle root of forest case too
authorMukund Sivaraman <muks@isc.org>
Fri, 6 Sep 2013 06:06:44 +0000 (11:36 +0530)
committerMukund Sivaraman <muks@isc.org>
Fri, 6 Sep 2013 06:06:44 +0000 (11:36 +0530)
src/lib/datasrc/memory/domaintree.h

index af080e288f79bf8fe16fb6bc9f52461d06f931e0..f7ab4ea4f762ce4c3119c08f625e86f4251ad80d 100644 (file)
@@ -2322,7 +2322,7 @@ DomainTree<T>::remove(util::MemorySegment& mem_sgmt, DomainTreeNode<T>* node,
         // Even if node is not a leaf node, we don't always do an
         // exchange() with another node, so we have to set the child's
         // FLAG_SUBTREE_ROOT explicitly.
-        if (child->getParent() &&
+        if ((!child->getParent()) ||
             (child->getParent()->getDown() == child))
         {
             child->setSubTreeRoot(node->isSubTreeRoot());
@@ -2953,8 +2953,8 @@ DomainTree<T>::checkPropertiesHelper(const DomainTreeNode<T>* node) const {
 
     // If node is assigned to the down_ pointer of its parent, it is a
     // subtree root and must have the flag set.
-    if (node->getParent() &&
-        (node->getParent()->getDown() == node) &&
+    if (((!node->getParent()) ||
+         (node->getParent()->getDown() == node)) &&
         (!node->isSubTreeRoot()))
     {
         return (false);