[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151592 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/malloc-interprocedural.c b/test/Analysis/malloc-interprocedural.c
index e67c14b..374c4a3 100644
--- a/test/Analysis/malloc-interprocedural.c
+++ b/test/Analysis/malloc-interprocedural.c
@@ -38,8 +38,10 @@
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 @@
fooWithEmptyReturn(12);
return *x; // expected-warning {{Use of memory after it is freed}}
}
-