diff options
author | Anna Zaks <ganna@apple.com> | 2012-02-22 19:24:52 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-02-22 19:24:52 +0000 |
commit | 40a7eb38375699a9956bbe3cbb713433bf1d7b8c (patch) | |
tree | 0f6cd4e2f4e67083fafff38827fc0dc26e6b8791 /clang/test | |
parent | c862da47e39b0c1800f8ed2c33ce4176e50c7b44 (diff) | |
download | bcm5719-llvm-40a7eb38375699a9956bbe3cbb713433bf1d7b8c.tar.gz bcm5719-llvm-40a7eb38375699a9956bbe3cbb713433bf1d7b8c.zip |
[analyzer] Malloc cleanup:
- We should not evaluate strdup in the Malloc Checker, it's the job of
CString checker, so just update the RefState to reflect allocated
memory.
- Refactor to reduce LOC: remove some wrapper auxiliary functions, make
all functions return the state and add the transition in one place
(instead of in each auxiliary function).
llvm-svn: 151188
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Analysis/malloc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c index a38c30a5ed6..1923305fe20 100644 --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -671,6 +671,12 @@ int testStrndup(const char *s, unsigned validIndex, unsigned size) { return 1;// expected-warning {{Memory is never released; potential memory leak}} } +void testStrdupContentIsDefined(const char *s, unsigned validIndex) { + char *s2 = strdup(s); + char result = s2[1];// no warning + free(s2); +} + // Below are the known false positives. // TODO: There should be no warning here. This one might be difficult to get rid of. |