about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--lib/Core/PTree.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Core/PTree.cpp b/lib/Core/PTree.cpp
index f0e7ab51..77698bb5 100644
--- a/lib/Core/PTree.cpp
+++ b/lib/Core/PTree.cpp
@@ -37,7 +37,6 @@ void PTree::remove(Node *n) {
   assert(!n->left && !n->right);
   do {
     Node *p = n->parent;
-    delete n;
     if (p) {
       if (n == p->left) {
         p->left = 0;
@@ -46,6 +45,7 @@ void PTree::remove(Node *n) {
         p->right = 0;
       }
     }
+    delete n;
     n = p;
   } while (n && !n->left && !n->right);
 }