From 4789642b0b080e19931e11fb11315a40715efd99 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 14 May 2015 20:46:12 +0000 Subject: [PATCH] Fix memory leak introduced in r237314. The commit r237314 that implements YAML block parsing introduced a leak that was caught by the ASAN linux buildbot. YAML Parser stores its tokens in an ilist, and allocates tokens using a BumpPtrAllocator, but doesn't call the destructor for the allocated tokens. R237314 added an std::string field to a Token which leaked as the Token's destructor wasn't called. This commit fixes this leak by calling the Token's destructor when a Token is being removed from an ilist of tokens. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237389 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/YAMLParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Support/YAMLParser.cpp b/lib/Support/YAMLParser.cpp index be9ba00bbee..162a22bd910 100644 --- a/lib/Support/YAMLParser.cpp +++ b/lib/Support/YAMLParser.cpp @@ -168,7 +168,7 @@ struct ilist_node_traits { Token *createNode(const Token &V) { return new (Alloc.Allocate()) Token(V); } - static void deleteNode(Token *V) {} + static void deleteNode(Token *V) { V->~Token(); } void addNodeToList(Token *) {} void removeNodeFromList(Token *) {} -- 2.11.0