Author: zhongxingxu
Date: Sun Jan 17 21:27:34 2010
New Revision: 93706

URL: http://llvm.org/viewvc/llvm-project?rev=93706&view=rev
Log:
If the symbol has not been tracked, do not free it. This is possible when free
is called on a pointer that does not get its value directly from malloc.

Modified:
    cfe/trunk/lib/Analysis/MallocChecker.cpp

Modified: cfe/trunk/lib/Analysis/MallocChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MallocChecker.cpp?rev=93706&r1=93705&r2=93706&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/MallocChecker.cpp (original)
+++ cfe/trunk/lib/Analysis/MallocChecker.cpp Sun Jan 17 21:27:34 2010
@@ -170,7 +170,12 @@
   assert(Sym);
 
   const RefState *RS = state->get<RegionState>(Sym);
-  assert(RS);
+
+  // If the symbol has not been tracked, return. This is possible when free() 
is
+  // called on a pointer that does not get its pointee directly from malloc(). 
+  // Full support of this requires inter-procedural analysis.
+  if (!RS)
+    return state;
 
   // Check double free.
   if (RS->isReleased()) {


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to