summaryrefslogtreecommitdiff
path: root/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
commit4eeb7b662b78f5c520fb258b3f9df18b1227cde5 (patch)
tree55e1f3dd59068f605d220b7b264fe1689b8e9e3a /lib/MC/MCStreamer.cpp
parentc2d3022aa6104a21f4368c522ccbf9a4d282b7c6 (diff)
downloadllvm-4eeb7b662b78f5c520fb258b3f9df18b1227cde5.tar.gz
llvm-4eeb7b662b78f5c520fb258b3f9df18b1227cde5.tar.bz2
llvm-4eeb7b662b78f5c520fb258b3f9df18b1227cde5.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132174 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCStreamer.cpp')
-rw-r--r--lib/MC/MCStreamer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp
index 88293f561a..881bc8eaba 100644
--- a/lib/MC/MCStreamer.cpp
+++ b/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;