diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-09-01 19:25:52 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-09-01 19:25:52 +0000 |
commit | 0c971ca2967e9dd20f26d8d68cacb131dd2fb7ca (patch) | |
tree | ab3b33068def489ec6e0f0de1818f7abdc45b7e0 /lib/CodeGen/ELFWriter.cpp | |
parent | 231d73422a43624472e0ff74a1d9ec30740c7adb (diff) | |
download | external_llvm-0c971ca2967e9dd20f26d8d68cacb131dd2fb7ca.tar.gz external_llvm-0c971ca2967e9dd20f26d8d68cacb131dd2fb7ca.tar.bz2 external_llvm-0c971ca2967e9dd20f26d8d68cacb131dd2fb7ca.zip |
Fix ELF Writter related memory leaks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ELFWriter.cpp')
-rw-r--r-- | lib/CodeGen/ELFWriter.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index b1842ff3dc..55a2f70064 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -93,6 +93,24 @@ ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm) ELFWriter::~ELFWriter() { delete ElfCE; delete &OutContext; + + while(!SymbolList.empty()) { + delete SymbolList.back(); + SymbolList.pop_back(); + } + + while(!PrivateSyms.empty()) { + delete PrivateSyms.back(); + PrivateSyms.pop_back(); + } + + while(!SectionList.empty()) { + delete SectionList.back(); + SectionList.pop_back(); + } + + // Release the name mangler object. + delete Mang; Mang = 0; } // doInitialization - Emit the file header and all of the global variables for @@ -714,13 +732,6 @@ bool ELFWriter::doFinalization(Module &M) { // Dump the sections and section table to the .o file. OutputSectionsAndSectionTable(); - // We are done with the abstract symbols. - SymbolList.clear(); - SectionList.clear(); - NumSections = 0; - - // Release the name mangler object. - delete Mang; Mang = 0; return false; } |