Remove dead malloc symbols from the symbol-state map.
llvm-svn: 111353
diff --git a/clang/lib/Checker/MallocChecker.cpp b/clang/lib/Checker/MallocChecker.cpp
index 7aa89e0..0076e1e 100644
--- a/clang/lib/Checker/MallocChecker.cpp
+++ b/clang/lib/Checker/MallocChecker.cpp
@@ -567,6 +567,7 @@
const GRState *state = C.getState();
RegionStateTy RS = state->get<RegionState>();
+ RegionStateTy::Factory &F = state->get_context<RegionState>();
for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
if (SymReaper.isDead(I->first)) {
@@ -580,8 +581,14 @@
C.EmitReport(R);
}
}
+
+ // Remove the dead symbol from the map.
+ RS = F.Remove(RS, I->first);
}
}
+
+ state = state->set<RegionState>(RS);
+ C.GenerateNode(state);
}
void MallocChecker::EvalEndPath(GREndPathNodeBuilder &B, void *tag,