-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
Description
Bugzilla Link | 3958 |
Version | unspecified |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @tkremenek |
Extended Description
When some objects are allocated before or inside a @try block,
-checker-cfref doesn't "see" the code in the @finally block which deallocates these objects.
Test case, reporting false positives:
// RUN: clang-cc -analyze -checker-cfref -verify %s
#import <Foundation/Foundation.h>
void f1()
{
int i = 1;
while(i-- > 0)
{
NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init]; // no-warning. Currently produces: Potential leak of object allocated on line 10 and stored into 'innerPool'
NSArray *array = nil;
@​try {
array = [[NSMutableArray alloc] init]; // no-warning. Currently produces: Potential leak of object allocated on line 14 and stored into 'array'
break;
}
@​catch (NSException * e) {}
@​finally {
[array release];
[innerPool drain];
}
}
}
Clang revision: 68443