summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-05-18 21:11:27 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-05-18 21:11:27 +0000
commit7236733edc0b7794f54ab62cecb344e0be376962 (patch)
treebd29ff40931a6cec6ad2efa338a19400fff5fd86 /llvm/lib/Support
parent8904d6bb17fb8563665875d0de28b0159a1d0418 (diff)
downloadbcm5719-llvm-7236733edc0b7794f54ab62cecb344e0be376962.tar.gz
bcm5719-llvm-7236733edc0b7794f54ab62cecb344e0be376962.zip
[YAML] Plug a memory leak
The destructor of BlockScalarNode is never called. Store the contained string in BumpPtrAllocated memory instead. llvm-svn: 237614
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/YAMLParser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index 162a22bd910..41d446744fe 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -2377,11 +2377,13 @@ parse_property:
, AnchorInfo.Range.substr(1)
, TagInfo.Range
, T.Range);
- case Token::TK_BlockScalar:
+ case Token::TK_BlockScalar: {
getNext();
+ StringRef StrCopy = StringRef(T.Value).copy(NodeAllocator);
return new (NodeAllocator)
BlockScalarNode(stream.CurrentDoc, AnchorInfo.Range.substr(1),
- TagInfo.Range, T.Value, T.Range);
+ TagInfo.Range, StrCopy, T.Range);
+ }
case Token::TK_Key:
// Don't eat the TK_Key, KeyValueNode expects it.
return new (NodeAllocator)
OpenPOWER on IntegriCloud