summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc-annotations.c
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-08 18:23:31 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-08 18:23:31 +0000
commit356279ca2de74b0deb274a8b16396bdaebfec92b (patch)
treee55456feb9d16df82038375a4c9292091adaf575 /clang/test/Analysis/malloc-annotations.c
parent3a80cec5e92da70064541f1d11222e2e5c2d4e8c (diff)
downloadbcm5719-llvm-356279ca2de74b0deb274a8b16396bdaebfec92b.tar.gz
bcm5719-llvm-356279ca2de74b0deb274a8b16396bdaebfec92b.zip
[analyzer] Track malloc'd regions stored in structs.
The main blocker on this (besides the previous commit) was that ScanReachableSymbols was not looking through LazyCompoundVals. Once that was fixed, it's easy enough to clear out malloc data on return, just like we do when we bind to a global region. <rdar://problem/10872635> llvm-svn: 161511
Diffstat (limited to 'clang/test/Analysis/malloc-annotations.c')
-rw-r--r--clang/test/Analysis/malloc-annotations.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/test/Analysis/malloc-annotations.c b/clang/test/Analysis/malloc-annotations.c
index 089e53132d9..1dc0f7837ba 100644
--- a/clang/test/Analysis/malloc-annotations.c
+++ b/clang/test/Analysis/malloc-annotations.c
@@ -70,10 +70,9 @@ 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); // false negative
+ mystuff.somefield = my_malloc(12); // expected-warning{{Memory is never released; potential leak}}
}
// Test that we can pass out allocated memory via pointer-to-pointer.
OpenPOWER on IntegriCloud