summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-26 00:32:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-26 00:32:28 +0000
commit24d285d31ba07be9edff7788aa5003192dbbfb3a (patch)
treec5227133c235629d81d2041c041757b3e5fddecd /llvm/lib/MC
parent8324c2f8bee4d6d78005dbabaafb27bc11645266 (diff)
downloadbcm5719-llvm-24d285d31ba07be9edff7788aa5003192dbbfb3a.tar.gz
bcm5719-llvm-24d285d31ba07be9edff7788aa5003192dbbfb3a.zip
Call the destructors of the MCSections.
They now contain the fragments. If we don't call the destructors the fragments leak. Found by an asan bot. llvm-svn: 238161
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCContext.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 968fd26f326..0a453cdb46b 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -10,6 +10,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCLabel.h"
@@ -54,6 +55,13 @@ 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();
OpenPOWER on IntegriCloud