r176956 - [analyzer] fixed the logic changed by r176949

Anton Yartsev anton.yartsev at gmail.com
Wed Mar 13 10:07:33 PDT 2013


Author: ayartsev
Date: Wed Mar 13 12:07:32 2013
New Revision: 176956

URL: http://llvm.org/viewvc/llvm-project?rev=176956&view=rev
Log:
[analyzer] fixed the logic changed by r176949

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=176956&r1=176955&r2=176956&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Mar 13 12:07:32 2013
@@ -236,7 +236,7 @@ private:
   void ReportUseAfterFree(CheckerContext &C, SourceRange Range,
                           SymbolRef Sym) const;
   void ReportDoubleFree(CheckerContext &C, SourceRange Range, bool Released,
-                        SymbolRef Sym, bool Interesting) const;
+                        SymbolRef Sym, SymbolRef PrevSym) const;
 
   /// Find the location of the allocation for Sym on the path leading to the
   /// exploded node N.
@@ -969,7 +969,7 @@ void MallocChecker::ReportUseAfterFree(C
 
 void MallocChecker::ReportDoubleFree(CheckerContext &C, SourceRange Range,
                                      bool Released, SymbolRef Sym, 
-                                     bool Interesting) const {
+                                     SymbolRef PrevSym) const {
 
   if (ExplodedNode *N = C.generateSink()) {
     if (!BT_DoubleFree)
@@ -980,8 +980,9 @@ void MallocChecker::ReportDoubleFree(Che
                 : "Attempt to free non-owned memory"),
       N);
     R->addRange(Range);
-    if (Interesting)
-      R->markInteresting(Sym);
+    R->markInteresting(Sym);
+    if (PrevSym)
+      R->markInteresting(PrevSym);
     R->addVisitor(new MallocBugVisitor(Sym));
     C.emitReport(R);
   }





More information about the cfe-commits mailing list