From e58d0412cbde4e0f1a4490e7ce4c5d480866bfbe Mon Sep 17 00:00:00 2001 From: Andrea Mattavelli Date: Tue, 9 Aug 2016 13:50:45 +0100 Subject: Fix to PTree pointer use-after-delete undefined behavior --- lib/Core/PTree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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); } -- cgit 1.4.1