summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-08-04 02:04:27 +0000
committerAnna Zaks <ganna@apple.com>2012-08-04 02:04:27 +0000
commit6ce686e6a4f222ed753ea630a1d6051853150205 (patch)
tree7e1af91de603dd0043afcabe56cd2e0f840f18d5 /clang/test/Analysis/malloc.c
parent0efe2743f8ed20188821fe23d4ea296123689ed3 (diff)
downloadbcm5719-llvm-6ce686e6a4f222ed753ea630a1d6051853150205.tar.gz
bcm5719-llvm-6ce686e6a4f222ed753ea630a1d6051853150205.zip
[analyzer] Malloc: remove assert since is not valid as of r161248
We can be in the situation where we did not track the symbol before realloc was called on it. llvm-svn: 161294
Diffstat (limited to 'clang/test/Analysis/malloc.c')
-rw-r--r--clang/test/Analysis/malloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c
index 964424647f6..7f5062af458 100644
--- a/clang/test/Analysis/malloc.c
+++ b/clang/test/Analysis/malloc.c
@@ -1007,3 +1007,15 @@ void freeButNoMalloc(int *p, int x){
}
free(p); // expected-warning {{Attempt to free released memory}}
}
+
+struct HasPtr {
+ int *p;
+};
+
+int* reallocButNoMalloc(struct HasPtr *a, int c, int size) {
+ int *s;
+ a->p = (int *)realloc(a->p, size);
+ if (a->p == 0)
+ return 0; // expected-warning{{Memory is never released; potential leak}}
+ return a->p;
+}
OpenPOWER on IntegriCloud