diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-09-14 20:40:59 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-09-14 20:40:59 +0000 |
commit | 90b6acf414327f953aa696cd64a449a4bd4fbb0d (patch) | |
tree | f317eeb6d44f8b430ca20ab909f260ea53215e6f /lib/Analysis/BugReporter.cpp | |
parent | cf43d8b8c4598c5f76ed8831b6fbe0e929e69ab7 (diff) |
Implement FIXME: free up BugReportEquivClass objects when deleting BugTypes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index 3a3a51a42c..dd1cbf6bd1 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/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; } |