This bug was introduced by http://reviews.llvm.org/rL265059,
where InputSectionBase got Thunks field, which can do memory allocations.
Since InputSectionBase destructors were never called (I count it as another bug),
that caused a memory leak when 2 or more thunks are added to a section.
The fix to is properly call InputSectionBase destructors from ~ObjectFile.
This seems to be a bit too fragile. Generally, I prefer unique_ptr or SpecificBumpPtrAllocator or something like that over explicit destructors. Can you update InputFiles.cpp so that InputSection<ELFT> are allocated in the same way as EHInputSection<ELFT> or MergeInputSection<ELFT>? (i.e. using SpecificBumpPtrAllocator)