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 | 92e18c456afdade9fd4d19e74aee12823cc72217 (patch) | |
tree | 5e440610e6dcf9e5fb963563ae7530c9407bbfda /llvm/lib/CodeGen/ELFWriter.cpp | |
parent | e3cdafc70b843bfa0276053084e03eeb72b545d0 (diff) | |
download | bcm5719-llvm-92e18c456afdade9fd4d19e74aee12823cc72217.tar.gz bcm5719-llvm-92e18c456afdade9fd4d19e74aee12823cc72217.zip |
Fix ELF Writter related memory leaks
llvm-svn: 80717
Diffstat (limited to 'llvm/lib/CodeGen/ELFWriter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ELFWriter.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp index b1842ff3dc7..55a2f700643 100644 --- a/llvm/lib/CodeGen/ELFWriter.cpp +++ b/llvm/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; } |