aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-11-13 03:34:49 +0000
committerAnna Zaks <ganna@apple.com>2012-11-13 03:34:49 +0000
commitcbf5f60996fa2bd0ecd779b1472dc5cbad3ca464 (patch)
tree44b6e7d5bd49ea6c60a7a016208041727575916e
parent4141e4dcab6b175374710925aa90d547600a5e66 (diff)
Add a test that shows that reporting a leak after failure to free is
tricky. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167814 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/malloc.mm7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/Analysis/malloc.mm b/test/Analysis/malloc.mm
index 34b3c33499..99d1de8022 100644
--- a/test/Analysis/malloc.mm
+++ b/test/Analysis/malloc.mm
@@ -245,9 +245,12 @@ void test12365078_no_malloc(unichar *characters) {
if (!string) {free(characters);}
}
-void test12365078_false_negative_no_malloc(unichar *characters) {
+NSString *test12365078_no_malloc_returnValue(unichar *characters) {
NSString *string = [[NSString alloc] initWithCharactersNoCopy:characters length:12 freeWhenDone:1];
- if (!string) {;}
+ if (!string) {
+ return 0; // no-warning
+ }
+ return string;
}
void test12365078_nocheck_nomalloc(unichar *characters) {