[cfe-commits] r151008 - /cfe/trunk/test/Analysis/malloc-interprocedural.c
Anna Zaks
ganna at apple.com
Mon Feb 20 16:00:48 PST 2012
Author: zaks
Date: Mon Feb 20 18:00:48 2012
New Revision: 151008
URL: http://llvm.org/viewvc/llvm-project?rev=151008&view=rev
Log:
[analyzer] + a couple more malloc tests.
Modified:
cfe/trunk/test/Analysis/malloc-interprocedural.c
Modified: cfe/trunk/test/Analysis/malloc-interprocedural.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc-interprocedural.c?rev=151008&r1=151007&r2=151008&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc-interprocedural.c (original)
+++ cfe/trunk/test/Analysis/malloc-interprocedural.c Mon Feb 20 18:00:48 2012
@@ -32,6 +32,12 @@
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 @@
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);
+}
More information about the cfe-commits
mailing list