summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc-interprocedural.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-02-27 23:40:55 +0000
committerAnna Zaks <ganna@apple.com>2012-02-27 23:40:55 +0000
commit43ffba26761164bcb54ad2f30d61fd845e1b98a6 (patch)
treeaba0cd7690c5ddfaf67677d98323ab36b014687d /clang/test/Analysis/malloc-interprocedural.c
parent9cd797aa3efdac5eab3496695beb13e625cbafe0 (diff)
downloadbcm5719-llvm-43ffba26761164bcb54ad2f30d61fd845e1b98a6.tar.gz
bcm5719-llvm-43ffba26761164bcb54ad2f30d61fd845e1b98a6.zip
[analyzer] Leaks should be uniqued by the allocation point in the
closest function context. This prevents us from uniqueing all leaks from the same allocation helper. radar://10932226 llvm-svn: 151592
Diffstat (limited to 'clang/test/Analysis/malloc-interprocedural.c')
-rw-r--r--clang/test/Analysis/malloc-interprocedural.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/test/Analysis/malloc-interprocedural.c b/clang/test/Analysis/malloc-interprocedural.c
index e67c14be426..374c4a310d1 100644
--- a/clang/test/Analysis/malloc-interprocedural.c
+++ b/clang/test/Analysis/malloc-interprocedural.c
@@ -38,8 +38,10 @@ static void test11() {
my_free1(data);
}
-static void test2() {
- void * data = my_malloc2(1, 4);
+static void testUniqueingByallocationSiteInTopLevelFunction() {
+ void *data = my_malloc2(1, 4);
+ data = 0;
+ int x = 5;// expected-warning {{Memory is never released; potential memory leak}}
data = my_malloc2(1, 4);// expected-warning {{Memory is never released; potential memory leak}}
}
@@ -94,4 +96,3 @@ int uafAndCallsFooWithEmptyReturn() {
fooWithEmptyReturn(12);
return *x; // expected-warning {{Use of memory after it is freed}}
}
-
OpenPOWER on IntegriCloud