[llvm-commits] [llvm] r132174 - /llvm/trunk/lib/MC/MCStreamer.cpp
Charles Davis
cdavis at mines.edu
Thu May 26 19:01:09 PDT 2011
Author: cdavis
Date: Thu May 26 21:01:08 2011
New Revision: 132174
URL: http://llvm.org/viewvc/llvm-project?rev=132174&view=rev
Log:
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.
Modified:
llvm/trunk/lib/MC/MCStreamer.cpp
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=132174&r1=132173&r2=132174&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Thu May 26 21:01:08 2011
@@ -28,6 +28,8 @@
}
MCStreamer::~MCStreamer() {
+ for (unsigned i = 0; i < getNumW64UnwindInfos(); ++i)
+ delete W64UnwindInfos[i];
}
const MCExpr *MCStreamer::BuildSymbolDiff(MCContext &Context,
@@ -321,7 +323,7 @@
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::EmitWin64EHStartChained() {
EnsureValidW64UnwindInfo();
- MCWin64EHUnwindInfo *Frame = new (getContext()) MCWin64EHUnwindInfo;
+ MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo;
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
Frame->Begin = getContext().CreateTempSymbol();
Frame->Function = CurFrame->Function;
More information about the llvm-commits
mailing list