[PATCH] fix a small leak in MC/MCAsmStreamer.cpp
David Blaikie
dblaikie at gmail.com
Thu Apr 24 07:41:43 PDT 2014
Thanks for tracking down the bug, Kostya - I've applied a different
fix for this in r207118. Do let me know if this still shows up/is
insufficient/problematic in any way.
(Yay value semantics! \o/)
On Thu, Apr 24, 2014 at 6:43 AM, Kostya Serebryany <kcc at google.com> wrote:
> Hi,
> Here is a small patch that fixes (mostly innocent) leak in
> lib/MC/MCAsmStreamer.cpp,
> please review.
> See also http://llvm.org/bugs/show_bug.cgi?id=19521
>
> Index: lib/MC/MCAsmStreamer.cpp
> ===================================================================
> --- lib/MC/MCAsmStreamer.cpp (revision 207084)
> +++ lib/MC/MCAsmStreamer.cpp (working copy)
> @@ -9,6 +9,7 @@
>
> #include "llvm/MC/MCStreamer.h"
> #include "llvm/ADT/SmallString.h"
> +#include "llvm/ADT/STLExtras.h"
> #include "llvm/ADT/StringExtras.h"
> #include "llvm/ADT/Twine.h"
> #include "llvm/MC/MCAsmBackend.h"
> @@ -76,7 +77,9 @@
> if (InstPrinter && IsVerboseAsm)
> InstPrinter->setCommentStream(CommentStream);
> }
> - ~MCAsmStreamer() {}
> + ~MCAsmStreamer() {
> + DeleteContainerSeconds(SymbolMap);
> + }
>
> inline void EmitEOL() {
> // If we don't have any comments, just emit a \n.
>
>
> =================================
> Leak report:
> Direct leak of 80 byte(s) in 1 object(s) allocated from:
> #0 0x65d4b0 in operator new(unsigned long)
> llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
> #1 0x20d9f9e in (anonymous
> namespace)::MCAsmStreamer::getOrCreateSymbolData(llvm::MCSymbol const*)
> llvm/lib/MC/MCAsmStreamer.cpp:1476
> #2 0xd4a029 in (anonymous
> namespace)::ARMAsmParser::onLabelParsed(llvm::MCSymbol*)
> llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:8328
> #3 0x2924e87 in (anonymous
> namespace)::AsmParser::parseStatement((anonymous
> namespace)::ParseStatementInfo&) llvm/lib/MC/MCParser/AsmParser.cpp:1306
> #4 0x29123a1 in (anonymous namespace)::AsmParser::Run(bool, bool)
> llvm/lib/MC/MCParser/AsmParser.cpp:651
> #5 0x18bc27f in llvm::AsmPrinter::EmitInlineAsm(llvm::StringRef,
> llvm::MDNode const*, llvm::InlineAsm::AsmDialect) const
> llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:151
> #6 0x18bfc1e in llvm::AsmPrinter::EmitInlineAsm(llvm::MachineInstr
> const*) const llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:487
> #7 0x189aa80 in llvm::AsmPrinter::EmitFunctionBody()
> llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:781
> #8 0xa0d144 in runOnMachineFunction
> llvm/include/llvm/CodeGen/AsmPrinter.h:193
> #9 0xa0d144 in
> llvm::ARMAsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
> llvm/lib/Target/ARM/ARMAsmPrinter.cpp:100
> #10 0x1b0566b in
> llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
> llvm/lib/CodeGen/MachineFunctionPass.cpp:33
> #11 0x2025905 in llvm::FPPassManager::runOnFunction(llvm::Function&)
> llvm/lib/IR/LegacyPassManager.cpp:1540
> #12 0x2025dd5 in llvm::FPPassManager::runOnModule(llvm::Module&)
> llvm/lib/IR/LegacyPassManager.cpp:1560
> #13 0x2026aac in runOnModule llvm/lib/IR/LegacyPassManager.cpp:1618
> #14 0x2026aac in llvm::legacy::PassManagerImpl::run(llvm::Module&)
> llvm/lib/IR/LegacyPassManager.cpp:1725
> #15 0x683cf7 in compileModule llvm/tools/llc/llc.cpp:355
> #16 0x683cf7 in main llvm/tools/llc/llc.cpp:201
>
More information about the llvm-commits
mailing list