Ted Kremenek | 8382cf5 | 2009-11-13 18:46:29 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s |
Zhongxing Xu | fc7ac8f | 2009-11-13 07:48:11 +0000 | [diff] [blame] | 2 | #include <stdlib.h> |
| 3 | |
| 4 | void f1() { |
| 5 | int *p = malloc(10); |
| 6 | return; // expected-warning{{Allocated memory never released. Potential memory leak.}} |
| 7 | } |
| 8 | |
| 9 | void f2() { |
| 10 | int *p = malloc(10); |
| 11 | free(p); |
| 12 | free(p); // expected-warning{{Try to free a memory block that has been released}} |
| 13 | } |