summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2011-05-27 02:01:08 +0000
committerCharles Davis <cdavis@mines.edu>2011-05-27 02:01:08 +0000
commita60cd577fd94bbff22f823e20e75888877ac04a1 (patch)
tree83fe75543e72d11273bbeb10a665a451eb7ce740 /llvm/lib/MC/MCStreamer.cpp
parent9dcee31aabd7bf94396e46d010d2afcbd608fe6d (diff)
downloadbcm5719-llvm-a60cd577fd94bbff22f823e20e75888877ac04a1.tar.gz
bcm5719-llvm-a60cd577fd94bbff22f823e20e75888877ac04a1.zip
My attempt at fixing the leak reported by the valgrind buildbots. Valgrind will
still report leaks, but they're spurious now. Valgrind cannot peer into std::vector objects--or any dynamic array, for that matter--because it doesn't know how big the array is. llvm-svn: 132174
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 88293f561ae..881bc8eabae 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -28,6 +28,8 @@ MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx), EmitEHFrame(true),
}
MCStreamer::~MCStreamer() {
+ for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i)
+ delete W64UnwindInfos[i];
}
const MCExpr *MCStreamer::BuildSymbolDiff(MCContext &Context,
@@ -321,7 +323,7 @@ void MCStreamer::EmitWin64EHStartProc(const MCSymbol *Symbol) {
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
if (CurFrame && !CurFrame->End)
report_fatal_error("Starting a function before ending the previous one!");
- MCWin64EHUnwindInfo *Frame = new (getContext()) MCWin64EHUnwindInfo;
+ MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo;
Frame->Begin = getContext().CreateTempSymbol();
Frame->Function = Symbol;
EmitLabel(Frame->Begin);
@@ -339,7 +341,7 @@ void MCStreamer::EmitWin64EHEndProc() {
void MCStreamer::EmitWin64EHStartChained() {
EnsureValidW64UnwindInfo();
- MCWin64EHUnwindInfo *Frame = new (getContext()) MCWin64EHUnwindInfo;
+ MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo;
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
Frame->Begin = getContext().CreateTempSymbol();
Frame->Function = CurFrame->Function;
OpenPOWER on IntegriCloud