aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/malloc-annotations.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-02-16 03:40:57 +0000
committerAnna Zaks <ganna@apple.com>2012-02-16 03:40:57 +0000
commitac593008c2035fa241c80352a0c97c5d853facbf (patch)
treed9b078fe29b1649bf05cadcfbc78efe5e78338e4 /test/Analysis/malloc-annotations.c
parent74e1ad93fa8d6347549bcb10279fdf1fbc775321 (diff)
[analyzer] Malloc Checker: Give up when a pointer escapes into a struct.
We are not properly handling the memory regions that escape into struct fields, which led to a bunch of false positives. Be conservative here and give up when a pointer escapes into a struct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/malloc-annotations.c')
-rw-r--r--test/Analysis/malloc-annotations.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/Analysis/malloc-annotations.c b/test/Analysis/malloc-annotations.c
index 98dc2e7269..4ee60ae14f 100644
--- a/test/Analysis/malloc-annotations.c
+++ b/test/Analysis/malloc-annotations.c
@@ -68,9 +68,10 @@ void af1_c() {
myglobalpointer = my_malloc(12); // no-warning
}
+// TODO: We will be able to handle this after we add support for tracking allocations stored in struct fields.
void af1_d() {
struct stuff mystuff;
- mystuff.somefield = my_malloc(12); // expected-warning{{Allocated memory never released. Potential memory leak.}}
+ mystuff.somefield = my_malloc(12); // false negative
}
// Test that we can pass out allocated memory via pointer-to-pointer.