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 | 2ccecfaa4852c134191d4075d94e09399ab46fea (patch) | |
tree | 1fb5a120ab1fedb015662df5bccd0056e82379bf /test | |
parent | 6e649737898ffb627c377fd8fa0a437d0a42ae4a (diff) |
[analyzer] Address Jordan's code review for r167813.
This simplifies logic, fixes a bug, and adds a test case.
Thanks Jordan!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167868 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/malloc.mm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Analysis/malloc.mm b/test/Analysis/malloc.mm index 99d1de8022..c92c966459 100644 --- a/test/Analysis/malloc.mm +++ b/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}} +} |