diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-26 01:52:19 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-26 01:52:19 +0000 |
commit | ed34d58c092b33b87068234f6f0be44444066ddb (patch) | |
tree | 24a66ce51ce408359e4b7bb794918387b5683664 /llvm/lib/MC/MCContext.cpp | |
parent | 7a3ce0c537023553eb3bf4c8d7bb696e66b8a2ff (diff) | |
download | bcm5719-llvm-ed34d58c092b33b87068234f6f0be44444066ddb.tar.gz bcm5719-llvm-ed34d58c092b33b87068234f6f0be44444066ddb.zip |
Move MCSection destruction to MCContext::reset.
Fixes the leaks when running llc.
Also found by an asan bot.
llvm-svn: 238167
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 0a453cdb46b..1f2f034a3ac 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -55,14 +55,6 @@ MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri, } MCContext::~MCContext() { - // Call the destructors so the fragments are freed - for (auto &I : ELFUniquingMap) - I.second->~MCSectionELF(); - for (auto &I : COFFUniquingMap) - I.second->~MCSectionCOFF(); - for (auto &I : MachOUniquingMap) - I.second->~MCSectionMachO(); - if (AutoReset) reset(); @@ -78,6 +70,14 @@ MCContext::~MCContext() { //===----------------------------------------------------------------------===// void MCContext::reset() { + // Call the destructors so the fragments are freed + for (auto &I : ELFUniquingMap) + I.second->~MCSectionELF(); + for (auto &I : COFFUniquingMap) + I.second->~MCSectionCOFF(); + for (auto &I : MachOUniquingMap) + I.second->~MCSectionMachO(); + UsedNames.clear(); Symbols.clear(); Allocator.Reset(); |