Delete the new visitor if an old one already exists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99114 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/BugReporter.cpp b/lib/Checker/BugReporter.cpp
index d4b1502..7272b34 100644
--- a/lib/Checker/BugReporter.cpp
+++ b/lib/Checker/BugReporter.cpp
@@ -44,8 +44,10 @@
visitor->Profile(ID);
void *InsertPos;
- if (CallbacksSet.FindNodeOrInsertPos(ID, InsertPos))
+ if (CallbacksSet.FindNodeOrInsertPos(ID, InsertPos)) {
+ delete visitor;
return;
+ }
CallbacksSet.InsertNode(visitor, InsertPos);
Callbacks = F.Add(visitor, Callbacks);