[cfe-commits] r150847 - /cfe/trunk/test/Analysis/malloc.c

Anna Zaks ganna at apple.com
Fri Feb 17 14:35:35 PST 2012


Author: zaks
Date: Fri Feb 17 16:35:34 2012
New Revision: 150847

URL: http://llvm.org/viewvc/llvm-project?rev=150847&view=rev
Log:
[analyzer] Malloc Checker more tests.

Modified:
    cfe/trunk/test/Analysis/malloc.c

Modified: cfe/trunk/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.c?rev=150847&r1=150846&r2=150847&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc.c (original)
+++ cfe/trunk/test/Analysis/malloc.c Fri Feb 17 16:35:34 2012
@@ -519,6 +519,23 @@
   return y;
 }
 
+void testElemRegion1() {
+  char *x = (void*)malloc(2);
+  int *ix = (int*)x;
+  free(&(x[0]));
+}
+
+void testElemRegion2(int **pp) {
+  int *p = malloc(12);
+  *pp = p;
+  free(pp[0]);
+}
+
+void testElemRegion3(int **pp) {
+  int *p = malloc(12);
+  *pp = p;
+  free(*pp);
+}
 // Region escape testing.
 
 unsigned takePtrToPtr(int **p);





More information about the cfe-commits mailing list