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
This commit is contained in:
Benjamin Kramer 2013-08-24 11:55:49 +00:00
parent 5b83d0c092
commit 6bee6319c6

View File

@ -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<DIE>);
return NULL;
}
// Add children
for (SmallVectorImpl<DIE *>::iterator I = Children.begin(),