aboutsummaryrefslogtreecommitdiff
path: root/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
commit4d33286d59e5d71a072c7e08ea0c5dd65e45b81c (patch)
tree74c643efe31bbe5d3e4097d13e075ac67d02e652 /test/Analysis/malloc.c
parentb34eb0c6f0ea24047ad2439825b4f6348e380315 (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/malloc.c')
-rw-r--r--test/Analysis/malloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index 964424647f..7f5062af45 100644
--- a/test/Analysis/malloc.c
+++ b/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;
+}