From 5188a2af721ff821aee387bd2de5d43c76b431c8 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 28 May 2015 12:55:43 +0000 Subject: [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. llvm-svn: 238418 --- llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp index cafaabba5a3..1060366a8ba 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/llvm/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. // -- cgit v1.2.3