summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-06-08 23:00:53 +0000
committerTed Kremenek <kremenek@apple.com>2010-06-08 23:00:53 +0000
commitdea66e3e4c80f6e31762e4db3fa9141fa010c975 (patch)
treedb276d080547500e0a434f3643b9a7ea8b6cc8cf /clang/lib/Lex/Preprocessor.cpp
parent954238366b5968de2f899fd5ebab615f342fd3cd (diff)
downloadbcm5719-llvm-dea66e3e4c80f6e31762e4db3fa9141fa010c975.tar.gz
bcm5719-llvm-dea66e3e4c80f6e31762e4db3fa9141fa010c975.zip
Fix memory leak in Preprocessor where MacroInfo objects in the MICache wouldn't have their
associated SmallVectors get deallocated. llvm-svn: 105658
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index ce6d9ab5c05..c20ecef47bd 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -113,6 +113,14 @@ Preprocessor::~Preprocessor() {
I->second->Destroy(BP);
I->first->setHasMacroDefinition(false);
}
+ for (std::vector<MacroInfo*>::iterator I = MICache.begin(),
+ E = MICache.end(); I != E; ++I) {
+ // We don't need to free the MacroInfo objects directly. These
+ // will be released when the BumpPtrAllocator 'BP' object gets
+ // destroyed. We still need to run the dtor, however, to free
+ // memory alocated by MacroInfo.
+ (*I)->Destroy(BP);
+ }
// Free any cached macro expanders.
for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i)
OpenPOWER on IntegriCloud