]> granicus.if.org Git - clang/commitdiff
Use 'GenerateNode()' instead of 'GenerateSink()' when reporting a leak. A leak is...
authorTed Kremenek <kremenek@apple.com>
Fri, 6 Aug 2010 21:12:49 +0000 (21:12 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 6 Aug 2010 21:12:49 +0000 (21:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110471 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/MallocChecker.cpp

index f6125636f2a35f137748fcf369eeee77d9f61b4f..5ad1706e0551e1fb6e98c75c904c096d9cc7997e 100644 (file)
@@ -650,9 +650,8 @@ void MallocChecker::VisitLocation(CheckerContext &C, const Stmt *S, SVal l) {
   SymbolRef Sym = l.getLocSymbolInBase();
   if (Sym) {
     const RefState *RS = C.getState()->get<RegionState>(Sym);
-    if (RS)
-      if (RS->isReleased()) {
-        ExplodedNode *N = C.GenerateSink();
+    if (RS && RS->isReleased()) {
+      if (ExplodedNode *N = C.GenerateNode()) {
         if (!BT_UseFree)
           BT_UseFree = new BuiltinBug("Use dynamically allocated memory after"
                                       " it is freed.");
@@ -661,6 +660,7 @@ void MallocChecker::VisitLocation(CheckerContext &C, const Stmt *S, SVal l) {
                                      N);
         C.EmitReport(R);
       }
+    }
   }
 }