From 6bee6319c64d2c5dae98491f8a6ab65981708109 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 24 Aug 2013 11:55:49 +0000 Subject: [PATCH] DwarfDebug: Delete orphaned children. Leak found by valgrind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189167 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 89531235358..f625afe71e1 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -639,7 +639,10 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) { constructImportedEntityDIE(TheCU, i->second, ScopeDIE); } - if (!ScopeDIE) return NULL; + if (!ScopeDIE) { + std::for_each(Children.begin(), Children.end(), deleter); + return NULL; + } // Add children for (SmallVectorImpl::iterator I = Children.begin(), -- 2.34.1