about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2016-08-10 10:01:12 +0200
committerGitHub <noreply@github.com>2016-08-10 10:01:12 +0200
commit66b3470f4d01df50bc77d9f96e3c526e8e4cbf91 (patch)
tree7156a084d6f60d13c1f48ca44f6c332e85af615e
parent74d88a5e0d6020fc262c166e42b8acdc335b4999 (diff)
parente58d0412cbde4e0f1a4490e7ce4c5d480866bfbe (diff)
downloadklee-66b3470f4d01df50bc77d9f96e3c526e8e4cbf91.tar.gz
Merge pull request #451 from andreamattavelli/fix_ub_ptree
Fix to PTree pointer use-after-delete
-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);
 }