summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/YAMLParser.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-05-14 20:46:12 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-05-14 20:46:12 +0000
commit4936030ed38ff30852e056927a29df854105bcf8 (patch)
treefb9550a34c465fbc9f01350e86a70be013f1b1ca /llvm/lib/Support/YAMLParser.cpp
parent7c8a3b0ef6172a919d760a717d819069a4b55c71 (diff)
downloadbcm5719-llvm-4936030ed38ff30852e056927a29df854105bcf8.tar.gz
bcm5719-llvm-4936030ed38ff30852e056927a29df854105bcf8.zip
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. llvm-svn: 237389
Diffstat (limited to 'llvm/lib/Support/YAMLParser.cpp')
-rw-r--r--llvm/lib/Support/YAMLParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index be9ba00bbee..162a22bd910 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -168,7 +168,7 @@ struct ilist_node_traits<Token> {
Token *createNode(const Token &V) {
return new (Alloc.Allocate<Token>()) Token(V);
}
- static void deleteNode(Token *V) {}
+ static void deleteNode(Token *V) { V->~Token(); }
void addNodeToList(Token *) {}
void removeNodeFromList(Token *) {}
OpenPOWER on IntegriCloud