r224796 - [analyzer] +memory.ZeroAlloc

Anton Yartsev anton.yartsev at gmail.com
Tue Dec 23 16:46:56 PST 2014


Author: ayartsev
Date: Tue Dec 23 18:46:56 2014
New Revision: 224796

URL: http://llvm.org/viewvc/llvm-project?rev=224796&view=rev
Log:
[analyzer] +memory.ZeroAlloc

Modified:
    cfe/trunk/www/analyzer/potential_checkers.html

Modified: cfe/trunk/www/analyzer/potential_checkers.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/potential_checkers.html?rev=224796&r1=224795&r2=224796&view=diff
==============================================================================
--- cfe/trunk/www/analyzer/potential_checkers.html (original)
+++ cfe/trunk/www/analyzer/potential_checkers.html Tue Dec 23 18:46:56 2014
@@ -104,6 +104,31 @@ void test() {
 </pre></div></div></td>
 <td class="aligned"></td></tr>
 
+<tr><td><div class="namedescr expandable"><span class="name">
+memory.ZeroAlloc</span><span class="lang">
+(C, C++)</span><div class="descr">
+Allocation of zero bytes.
+<br>Note: an enhancement to <span class="name">unix.Malloc</span>.
+<br>Note: <span class="name">unix.API</span> perform C-checks for zero 
+allocation. This should be moved to <span class="name">unix.Malloc</span>.
+<p>Source: C++03 3.7.3.1p2; C++11 3.7.4.1p2.</p></div></div></td>
+<td><div class="exampleContainer expandable">
+<div class="example"><pre>
+#include <stdlib.h>
+
+void test() {
+  int *p = malloc(0); // warn
+  free(p);
+}
+</pre></div>
+<div class="example"><pre>
+void test() {
+  int *p = new int[0]; // warn
+  delete[] p;
+}
+</pre></div></div></td>
+<td class="aligned"></td></tr>
+
 </table>
 
 <!-- ======================= constructors/destructors ====================== -->
@@ -461,7 +486,7 @@ unix.Malloc</span>.
 <p>Source: C++03 3.7.3.1p2; C++11 3.7.4.1p2.</p></div></div></td>
 <td><div class="exampleContainer expandable">
 <div class="example"><pre>
-#include <memory>
+#include <stdlib.h>
 
 void test() {
   int *p = (int *)malloc(0);





More information about the cfe-commits mailing list