Fix memory leak.
Symbol's dtors are not called because they are allocated using
BumpPtrAllocators. So, members of std::unique_ptr type are not
freed when symbols are deallocated.
This patch is to allocate Thunks using BumpPtrAllocators.
llvm-svn: 274896
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 3495da4..de38fc4 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -353,8 +353,9 @@
InputSectionBase<ELFT> *Sec = getSection(*Sym);
if (Binding == STB_LOCAL) {
if (Sym->st_shndx == SHN_UNDEF)
- return new (Alloc) Undefined(Sym->st_name, Sym->st_other, Sym->getType());
- return new (Alloc) DefinedRegular<ELFT>(*Sym, Sec);
+ return new (this->Alloc)
+ Undefined(Sym->st_name, Sym->st_other, Sym->getType());
+ return new (this->Alloc) DefinedRegular<ELFT>(*Sym, Sec);
}
StringRef Name = check(Sym->getName(this->StringTable));