[llvm-commits] [llvm] r80717 - /llvm/trunk/lib/CodeGen/ELFWriter.cpp
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Tue Sep 1 12:25:52 PDT 2009
Author: bruno
Date: Tue Sep 1 14:25:52 2009
New Revision: 80717
URL: http://llvm.org/viewvc/llvm-project?rev=80717&view=rev
Log:
Fix ELF Writter related memory leaks
Modified:
llvm/trunk/lib/CodeGen/ELFWriter.cpp
Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=80717&r1=80716&r2=80717&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Tue Sep 1 14:25:52 2009
@@ -93,6 +93,24 @@
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 @@
// 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;
}
More information about the llvm-commits
mailing list