diff options
author | Anna Zaks <ganna@apple.com> | 2012-02-21 00:00:48 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-02-21 00:00:48 +0000 |
commit | 362054766d3dacb8a87c0ee3f503d096709adf08 (patch) | |
tree | eeac6ad8b423716094e08e91b6a47a9769e7f912 | |
parent | 9c1e1bd0405b990b6e7909647def7b23d5c28f17 (diff) |
[analyzer] + a couple more malloc tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151008 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/malloc-interprocedural.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Analysis/malloc-interprocedural.c b/test/Analysis/malloc-interprocedural.c index 8ae6024d7e..d3a2ea7508 100644 --- a/test/Analysis/malloc-interprocedural.c +++ b/test/Analysis/malloc-interprocedural.c @@ -32,6 +32,12 @@ static void test1() { my_malloc1(&data, 4); // expected-warning {{Memory is never released; potential memory leak}} } +static void test11() { + void *data = 0; + my_malloc1(&data, 4); + my_free1(data); +} + static void test2() { void * data = my_malloc2(1, 4); data = my_malloc2(1, 4);// expected-warning {{Memory is never released; potential memory leak}} @@ -52,3 +58,14 @@ int test4() { return *data; // expected-warning {{Use of memory after it is freed}} } +void test6() { + int *data = (int *)my_malloc2(1, 4); + my_free1((int*)data); + my_free1((int*)data); // expected-warning{{Use of memory after it is freed}} +} + +// TODO: We should warn here. +void test5() { + int *data; + my_free1((int*)data); +} |