blob: acbfb4c38f36e0733d4a6521fcf86502b89d3137 [file] [log] [blame]
Ted Kremenek8382cf52009-11-13 18:46:29 +00001// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s
Zhongxing Xufc7ac8f2009-11-13 07:48:11 +00002#include <stdlib.h>
3
4void f1() {
5 int *p = malloc(10);
6 return; // expected-warning{{Allocated memory never released. Potential memory leak.}}
7}
8
Ted Kremenekba930872009-11-13 19:53:32 +00009// THIS TEST CURRENTLY FAILS.
10void f1_b() {
11 int *p = malloc(10);
12}
13
Zhongxing Xufc7ac8f2009-11-13 07:48:11 +000014void f2() {
15 int *p = malloc(10);
16 free(p);
17 free(p); // expected-warning{{Try to free a memory block that has been released}}
18}