summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BugReporter.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-09-14 20:40:59 +0000
committerTed Kremenek <kremenek@apple.com>2009-09-14 20:40:59 +0000
commit37a118520cd980a58113c051a326e7debaf1e865 (patch)
treed1cb8fd27db2c92269d64d5fa525c5abb0587a78 /clang/lib/Analysis/BugReporter.cpp
parent1113741a03ac64a47fcdafd4788b35e6fbfb6f90 (diff)
downloadbcm5719-llvm-37a118520cd980a58113c051a326e7debaf1e865.tar.gz
bcm5719-llvm-37a118520cd980a58113c051a326e7debaf1e865.zip
Implement FIXME: free up BugReportEquivClass objects when deleting BugTypes.
llvm-svn: 81783
Diffstat (limited to 'clang/lib/Analysis/BugReporter.cpp')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 3a3a51a42c8..dd1cbf6bd13 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -1196,7 +1196,16 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD,
//===----------------------------------------------------------------------===//
// Methods for BugType and subclasses.
//===----------------------------------------------------------------------===//
-BugType::~BugType() {}
+BugType::~BugType() {
+ // Free up the equivalence class objects. Observe that we get a pointer to
+ // the object first before incrementing the iterator, as destroying the
+ // node before doing so means we will read from freed memory.
+ for (iterator I = begin(), E = end(); I !=E; ) {
+ BugReportEquivClass *EQ = &*I;
+ ++I;
+ delete EQ;
+ }
+}
void BugType::FlushReports(BugReporter &BR) {}
//===----------------------------------------------------------------------===//
@@ -1319,9 +1328,6 @@ void BugReporter::FlushReports() {
}
// Delete the BugType object.
-
- // FIXME: this will *not* delete the BugReportEquivClasses, since FoldingSet
- // only deletes the buckets, not the nodes themselves.
delete BT;
}
OpenPOWER on IntegriCloud