[cfe-commits] r153069 - /cfe/trunk/test/Analysis/retain-release.mm

Ted Kremenek kremenek at apple.com
Mon Mar 19 17:50:41 PDT 2012


On Mar 19, 2012, at 5:26 PM, Jordan Rose <jediknil at belkadan.com> wrote:

> 
> On Mar 19, 2012, at 17:10, Ted Kremenek wrote:
> 
>> +int rdar10553686_positive(void)
>> +{
>> +  NSObject* bar = static_objc_cast<NSObject*>([[NSObject alloc] init]); // expected-warning {{Potential leak}}
>> +  [bar release];
>> +  [bar retain];
>> +  return 0;
>> +}
> 
> Why is this not a use-after-free? Even if there is a valid test here, we shouldn't use an invalid test case. Or am I missing something?

No, it's another bug in the checker.  My brain's not operating.  Apparently we are still treating the pointer as "may escape" even though we are inlining the call to static_objc_cast.



More information about the cfe-commits mailing list