summaryrefslogtreecommitdiffstats
path: root/test/Analysis/malloc-annotations.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
committerdim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
commit554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch)
tree9abb1a658a297776086f4e0dfa6ca533de02104e /test/Analysis/malloc-annotations.c
parentbb67ca86b31f67faee50bd10c3b036d65751745a (diff)
downloadFreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip
FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/Analysis/malloc-annotations.c')
-rw-r--r--test/Analysis/malloc-annotations.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/Analysis/malloc-annotations.c b/test/Analysis/malloc-annotations.c
index a0c1452..1dc0f78 100644
--- a/test/Analysis/malloc-annotations.c
+++ b/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.
@@ -123,12 +122,11 @@ void af2e() {
free(p); // no-warning
}
-// This case would inflict a double-free elsewhere.
-// However, this case is considered an analyzer bug since it causes false-positives.
+// This case inflicts a possible double-free.
void af3() {
int *p = my_malloc(12);
my_hold(p);
- free(p); // no-warning
+ free(p); // expected-warning{{Attempt to free non-owned memory}}
}
int * af4() {
OpenPOWER on IntegriCloud