From: Ted Kremenek Date: Sun, 21 Mar 2010 04:38:40 +0000 (+0000) Subject: Delete the new visitor if an old one already exists. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e0e41c9bba167437072c47a140d51509ebeb73c;p=clang 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 d4b150294e..7272b34858 100644 --- a/lib/Checker/BugReporter.cpp +++ b/lib/Checker/BugReporter.cpp @@ -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);