From d8a8a3b6ad7c786dfcf341b080bd19b5d4b84b5b Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Fri, 17 Feb 2012 22:35:34 +0000 Subject: [PATCH] [analyzer] Malloc Checker more tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150847 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/malloc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c index 09f38e5a28..b50ce1d392 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -519,6 +519,23 @@ int *testMalloc3() { 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); -- 2.50.1