forked from OSchip/llvm-project
[analyzer] Updated tests for ZeroAllocDereference checker.
llvm-svn: 220911
This commit is contained in:
parent
6e3949a35c
commit
9959295142
|
@ -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>
|
<p>Source: C++03 3.7.3.1p2; C++11 3.7.4.1p2.</p></div></div></td>
|
||||||
<td><div class="exampleContainer expandable">
|
<td><div class="exampleContainer expandable">
|
||||||
<div class="example"><pre>
|
<div class="example"><pre>
|
||||||
int *p = malloc(0);
|
#include <memory>
|
||||||
*p = 1; // warn
|
|
||||||
|
void test() {
|
||||||
|
int *p = (int *)malloc(0);
|
||||||
|
*p = 1; // warn
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<div class="example"><pre>
|
<div class="example"><pre>
|
||||||
int *p = new int{};
|
void f(int);
|
||||||
int i = *p; // warn
|
|
||||||
|
void test() {
|
||||||
|
int *p = new int[0];
|
||||||
|
f(*p); // warn
|
||||||
|
delete[] p;
|
||||||
|
}
|
||||||
</pre></div></div></td>
|
</pre></div></div></td>
|
||||||
<td class="aligned"></td></tr>
|
<td class="aligned"></td></tr>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue