about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorAndrea Mattavelli <andreamattavelli@gmail.com>2016-08-09 13:50:45 +0100
committerAndrea Mattavelli <andreamattavelli@gmail.com>2016-08-09 13:50:45 +0100
commite58d0412cbde4e0f1a4490e7ce4c5d480866bfbe (patch)
tree320d6692834cb62653e3fc610af680e5018f65b3 /lib
parent171c119b48f67171b9cba1091bc58cb61edddd5b (diff)
downloadklee-e58d0412cbde4e0f1a4490e7ce4c5d480866bfbe.tar.gz
Fix to PTree pointer use-after-delete undefined behavior
Diffstat (limited to 'lib')
-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);
 }