]> granicus.if.org Git - clang/commitdiff
Delete the new visitor if an old one already exists.
authorTed Kremenek <kremenek@apple.com>
Sun, 21 Mar 2010 04:38:40 +0000 (04:38 +0000)
committerTed Kremenek <kremenek@apple.com>
Sun, 21 Mar 2010 04:38:40 +0000 (04:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99114 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/BugReporter.cpp

index d4b150294e617c68928f7cc48a9e26db1dd45057..7272b348581b20389c3455acada3250e0edb9dfe 100644 (file)
@@ -44,8 +44,10 @@ void BugReporterContext::addVisitor(BugReporterVisitor* visitor) {
   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);