summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc-interprocedural.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-02-24 16:49:46 +0000
committerAnna Zaks <ganna@apple.com>2012-02-24 16:49:46 +0000
commit18de54b1a6d6b98bc764d5d63c40a70b6ec0bfea (patch)
treee8f56984bdf2692710bbd67bf01a57fd200aeb7b /clang/test/Analysis/malloc-interprocedural.c
parentcdf24a9a5e1df287bdb3a1e9144588990051cb8e (diff)
downloadbcm5719-llvm-18de54b1a6d6b98bc764d5d63c40a70b6ec0bfea.tar.gz
bcm5719-llvm-18de54b1a6d6b98bc764d5d63c40a70b6ec0bfea.zip
[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
Diffstat (limited to 'clang/test/Analysis/malloc-interprocedural.c')
-rw-r--r--clang/test/Analysis/malloc-interprocedural.c10
1 files changed, 10 insertions, 0 deletions
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)
OpenPOWER on IntegriCloud