From: Benjamin Kramer Date: Thu, 28 May 2015 12:55:43 +0000 (+0000) Subject: [AsmPrinter] Destroy allocated DIEAbbrevs on teardown. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=331b719b2b093d2e3a0c22dd074ecd65d54e3631;p=oota-llvm.git [AsmPrinter] Destroy allocated DIEAbbrevs on teardown. DIEAbbrev contains a SmallVector that can leak for overly large abbrevs. They used to be owned by the DIE, but after the recent refactoring DWARFFile allocates its own abbrevs. Leak found by asan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238418 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/lib/CodeGen/AsmPrinter/DwarfFile.cpp index cafaabba5a3..1060366a8ba 100644 --- a/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -20,7 +20,10 @@ namespace llvm { DwarfFile::DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA) : Asm(AP), StrPool(DA, *Asm, Pref) {} -DwarfFile::~DwarfFile() {} +DwarfFile::~DwarfFile() { + for (DIEAbbrev *Abbrev : Abbreviations) + Abbrev->~DIEAbbrev(); +} // Define a unique number for the abbreviation. //