From: Charles Davis Date: Fri, 27 May 2011 02:01:08 +0000 (+0000) Subject: My attempt at fixing the leak reported by the valgrind buildbots. Valgrind will X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4eeb7b662b78f5c520fb258b3f9df18b1227cde5;p=oota-llvm.git 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 --- diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index 88293f561ae..881bc8eabae 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;