forked from OSchip/llvm-project
[analyzer] Fix a false positive reported on rare strange code, which happens to be in JSONKit
llvm-svn: 183055
This commit is contained in:
parent
1ec87e8bb0
commit
737926ba6c
|
@ -1890,6 +1890,12 @@ bool MallocChecker::doesNotFreeMemOrInteresting(const CallEvent *Call,
|
|||
return false;
|
||||
}
|
||||
|
||||
// We should escape on call to 'init'. This is especially relevant to the
|
||||
// receiver, as the corresponding symbol is usually not referenced after
|
||||
// the call.
|
||||
if (Msg->getMethodFamily() == OMF_init)
|
||||
return false;
|
||||
|
||||
// Otherwise, assume that the method does not free memory.
|
||||
// Most framework methods do not free memory.
|
||||
return true;
|
||||
|
|
|
@ -35,3 +35,13 @@ void rdar10579586(char x);
|
|||
}
|
||||
@end
|
||||
|
||||
@interface JKArray : NSObject {
|
||||
id * objects;
|
||||
}
|
||||
@end
|
||||
|
||||
void _JKArrayCreate() {
|
||||
JKArray *array = (JKArray *)malloc(12);
|
||||
array = [array init];
|
||||
free(array); // no-warning
|
||||
}
|
Loading…
Reference in New Issue