summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-06-27 00:15:32 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-06-27 00:15:32 +0000
commitf8b3ad611d7b51d0a24603fca497dbb553c38a5b (patch)
treee5e2fac4c49a3d9031463150f4808f62b6611498 /llvm/lib/IR/AsmWriter.cpp
parent5d13e2c02eef322ea4dff6b00745d4c4249ef027 (diff)
downloadbcm5719-llvm-f8b3ad611d7b51d0a24603fca497dbb553c38a5b.tar.gz
bcm5719-llvm-f8b3ad611d7b51d0a24603fca497dbb553c38a5b.zip
Plug a leak introduced by r240848
Apparently this obvious leak was never exercised before, but r240848 exposed it. Plug it. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/5075 llvm-svn: 240865
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 7efb8e2bc7b..fdfed9ee5ad 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1941,8 +1941,11 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Metadata *MD,
SlotTracker *Machine, const Module *Context,
bool FromValue) {
if (const MDNode *N = dyn_cast<MDNode>(MD)) {
- if (!Machine)
- Machine = new SlotTracker(Context);
+ std::unique_ptr<SlotTracker> MachineStorage;
+ if (!Machine) {
+ MachineStorage = make_unique<SlotTracker>(Context);
+ Machine = MachineStorage.get();
+ }
int Slot = Machine->getMetadataSlot(N);
if (Slot == -1)
// Give the pointer value instead of "badref", since this comes up all
OpenPOWER on IntegriCloud