diff options
author | Anna Zaks <ganna@apple.com> | 2012-11-13 19:47:40 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-11-13 19:47:40 +0000 |
commit | a14c1d09f6720c46396e2e0537807267affeb418 (patch) | |
tree | 9fd061ed1fa3f5e2aad79fdd3f4ffb41cbaff46f /clang/test/Analysis/malloc.mm | |
parent | 38d2284eeb0c0675688233f14a3326632cb377c1 (diff) | |
download | bcm5719-llvm-a14c1d09f6720c46396e2e0537807267affeb418.tar.gz bcm5719-llvm-a14c1d09f6720c46396e2e0537807267affeb418.zip |
[analyzer] Address Jordan's code review for r167813.
This simplifies logic, fixes a bug, and adds a test case.
Thanks Jordan!
llvm-svn: 167868
Diffstat (limited to 'clang/test/Analysis/malloc.mm')
-rw-r--r-- | clang/test/Analysis/malloc.mm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.mm b/clang/test/Analysis/malloc.mm index 99d1de80222..c92c966459c 100644 --- a/clang/test/Analysis/malloc.mm +++ b/clang/test/Analysis/malloc.mm @@ -272,3 +272,9 @@ void test12365078_nested(unichar *characters) { } } } + +void test12365078_check_positive() { + unichar *characters = (unichar*)malloc(12); + NSString *string = [[NSString alloc] initWithCharactersNoCopy:characters length:12 freeWhenDone:1]; + if (string) free(characters); // expected-warning{{Attempt to free non-owned memory}} +} |