From: Ted Kremenek Date: Sun, 29 Nov 2009 06:37:44 +0000 (+0000) Subject: Fix null dereference in UndefResultChecker identified by running the analyzer over... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4daa7cbd40807cf72ca83900e2c00ab3e1d7d6f;p=clang Fix null dereference in UndefResultChecker identified by running the analyzer over Postgresql. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90060 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/UndefResultChecker.cpp b/lib/Analysis/UndefResultChecker.cpp index da2439013c..ec12a988e5 100644 --- a/lib/Analysis/UndefResultChecker.cpp +++ b/lib/Analysis/UndefResultChecker.cpp @@ -76,9 +76,10 @@ void UndefResultChecker::PostVisitBinaryOperator(CheckerContext &C, } EnhancedBugReport *report = new EnhancedBugReport(*BT, OS.str().str().c_str(), N); - report->addRange(Ex->getSourceRange()); - if (Ex) + if (Ex) { + report->addRange(Ex->getSourceRange()); report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, Ex); + } else report->addVisitorCreator(bugreporter::registerTrackNullOrUndefValue, B); C.EmitReport(report);