diff options
| author | Anton Yartsev <anton.yartsev@gmail.com> | 2014-12-24 00:46:56 +0000 |
|---|---|---|
| committer | Anton Yartsev <anton.yartsev@gmail.com> | 2014-12-24 00:46:56 +0000 |
| commit | 50a91cca177893c3fa6e67957bd758ff206391d3 (patch) | |
| tree | b5ab15320128bdd68b2514a72d21945b424da67f /clang | |
| parent | e193e1c48beb2329150602d06d2c03a0943ff6ec (diff) | |
| download | bcm5719-llvm-50a91cca177893c3fa6e67957bd758ff206391d3.tar.gz bcm5719-llvm-50a91cca177893c3fa6e67957bd758ff206391d3.zip | |
[analyzer] +memory.ZeroAlloc
llvm-svn: 224796
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/www/analyzer/potential_checkers.html | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/clang/www/analyzer/potential_checkers.html b/clang/www/analyzer/potential_checkers.html index 7ac8c5c9f39..67ec5ab3d7a 100644 --- a/clang/www/analyzer/potential_checkers.html +++ b/clang/www/analyzer/potential_checkers.html @@ -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); |

