From: Benjamin Kramer Date: Fri, 23 Oct 2015 13:24:18 +0000 (+0000) Subject: [AST] Plug a memory leak when promoting a single ParentMap entry to a vector. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b8b2679d5dd7306d0125f2c15e84db9006b960b;p=clang [AST] Plug a memory leak when promoting a single ParentMap entry to a vector. Found by asan! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251110 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 90f9dbbb4a..dabc6f60dd 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -8774,11 +8774,11 @@ createDynTypedNode(const NestedNameSpecifierLoc &Node) { if (!NodeOrVector.template is()) { auto *Vector = new ASTContext::ParentVector( 1, getSingleDynTypedNodeFromParentMap(NodeOrVector)); - NodeOrVector = Vector; if (auto *Node = NodeOrVector .template dyn_cast()) delete Node; + NodeOrVector = Vector; } auto *Vector =