From 18de54b1a6d6b98bc764d5d63c40a70b6ec0bfea Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Fri, 24 Feb 2012 16:49:46 +0000 Subject: [analyzer] Run remove dead bindings before each call. This ensures that we report the bugs associated with symbols going out of scope in the correct function context. llvm-svn: 151369 --- clang/test/Analysis/malloc-interprocedural.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/test/Analysis/malloc-interprocedural.c') diff --git a/clang/test/Analysis/malloc-interprocedural.c b/clang/test/Analysis/malloc-interprocedural.c index 0cdd9fb2810..e67c14be426 100644 --- a/clang/test/Analysis/malloc-interprocedural.c +++ b/clang/test/Analysis/malloc-interprocedural.c @@ -70,6 +70,16 @@ void test5() { my_free1((int*)data); } +static char *reshape(char *in) { + return 0; +} + +void testThatRemoveDeadBindingsRunBeforeEachCall() { + char *v = malloc(12); + v = reshape(v); + v = reshape(v);// expected-warning {{Memory is never released; potential memory leak}} +} + // Test that we keep processing after 'return;' void fooWithEmptyReturn(int x) { if (x) -- cgit v1.2.3