diff options
Diffstat (limited to 'test/Analysis/malloc.m')
| -rw-r--r-- | test/Analysis/malloc.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Analysis/malloc.m b/test/Analysis/malloc.m index 21d2dafa38b6..ad16db52dff9 100644 --- a/test/Analysis/malloc.m +++ b/test/Analysis/malloc.m @@ -35,3 +35,18 @@ void rdar10579586(char x); } @end +@interface MyArray : NSObject { + id * objects; +} +@end + +void _ArrayCreate() { + MyArray *array = (MyArray *)malloc(12); + array = [array init]; + free(array); // no-warning +} + +void testNSDataTruePositiveLeak() { + char *b = (char *)malloc(12); + NSData *d = [[NSData alloc] initWithBytes: b length: 12]; // expected-warning {{Potential leak of memory pointed to by 'b'}} +}
\ No newline at end of file |
