aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/malloc-annotations.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-03-01 22:06:06 +0000
committerAnna Zaks <ganna@apple.com>2012-03-01 22:06:06 +0000
commitb3d7275c1a4a9f676af850cd661b56c4ad7ef5c9 (patch)
treeb440cd023ec5d050e060d42b32df306b24d1dccf /test/Analysis/malloc-annotations.c
parentad8de5142a592db1d947e4883b64f63936d5d682 (diff)
[analyzer] Fix a regression introduced in malloc with
attributes, introduced in r151188. + the test to catch it. Thanks to Ahmed Charles for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151840 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/malloc-annotations.c')
-rw-r--r--test/Analysis/malloc-annotations.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Analysis/malloc-annotations.c b/test/Analysis/malloc-annotations.c
index 70b55ebda2..fbc6391ea5 100644
--- a/test/Analysis/malloc-annotations.c
+++ b/test/Analysis/malloc-annotations.c
@@ -6,6 +6,8 @@ void *realloc(void *ptr, size_t size);
void *calloc(size_t nmemb, size_t size);
void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
void __attribute((ownership_takes(malloc, 1))) my_free(void *);
+void my_freeBoth(void *, void *)
+ __attribute((ownership_holds(malloc, 1, 2)));
void __attribute((ownership_returns(malloc, 1))) *my_malloc2(size_t);
void __attribute((ownership_holds(malloc, 1))) my_hold(void *);
@@ -260,3 +262,10 @@ char callocZeroesBad () {
}
return result; // expected-warning{{never released}}
}
+
+void testMultipleFreeAnnotations() {
+ int *p = malloc(12);
+ int *q = malloc(12);
+ my_freeBoth(p, q);
+}
+