diff options
author | Anton Yartsev <anton.yartsev@gmail.com> | 2014-10-30 15:16:26 +0000 |
---|---|---|
committer | Anton Yartsev <anton.yartsev@gmail.com> | 2014-10-30 15:16:26 +0000 |
commit | 16b770cc78954ac7388012fcf02155437fd1c281 (patch) | |
tree | 18c7ad28f10c1ce604656d3c6658c88ac0ca2f24 /www | |
parent | 828ce4c07f00c4796b8cd72cc6588fc1ce40d417 (diff) |
[analyzer] Updated tests for ZeroAllocDereference checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www')
-rw-r--r-- | www/analyzer/potential_checkers.html | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/www/analyzer/potential_checkers.html b/www/analyzer/potential_checkers.html index a06e9426fb..7ac8c5c9f3 100644 --- a/www/analyzer/potential_checkers.html +++ b/www/analyzer/potential_checkers.html @@ -461,12 +461,22 @@ 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> -int *p = malloc(0); -*p = 1; // warn +#include <memory> + +void test() { + int *p = (int *)malloc(0); + *p = 1; // warn + free(p); +} </pre></div> <div class="example"><pre> -int *p = new int{}; -int i = *p; // warn +void f(int); + +void test() { + int *p = new int[0]; + f(*p); // warn + delete[] p; +} </pre></div></div></td> <td class="aligned"></td></tr> |