diff options
author | Anna Zaks <ganna@apple.com> | 2012-02-09 06:25:51 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-02-09 06:25:51 +0000 |
commit | ff3b9fdbfd4ff3a8361640c0d8a12d9f0cc1ce6f (patch) | |
tree | 8e358a0b51961202b39c2585629ebdd45023aefa /test/Analysis/malloc.c | |
parent | cdfec5e5ea0d1cfebe27888ef072346704424ed8 (diff) |
[analyzer] Add custom path diagnostic to the Malloc Checker.
Very simple so far - we just highlight every allocation and release
site.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/malloc.c')
-rw-r--r-- | test/Analysis/malloc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c index 190a2548d7..7ffc9a1ec0 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -240,6 +240,14 @@ void mallocFreeUse_params() { myfooint(*p); //expected-warning{{Use dynamically allocated memory after it is freed}} } +void mallocFailedOrNot() { + int *p = malloc(12); + if (!p) + free(p); + else + free(p); +} + int *Gl; struct GlStTy { int *x; |