Running the static analyzer on this piece of code:
- (id) readForeignPref
{
CFPropertyListRef matchStyle = CFPreferencesCopyAppValue(CFSTR("PBXFindMatchStyle"), CFSTR("com.apple.Xcode"));
return [(id)matchStyle autorelease];
}
yields the following warning:
Call to function 'CFPreferencesCopyAppValue' returns a Core Foundation object with a +1 retain count (owning reference). Core Foundation objects are not automatically garbage collected.
Is this a warning I should fix with somethin ugly like that:
- (id) readForeignPref
{
CFPropertyListRef matchStyle = CFPreferencesCopyAppValue(CFSTR("PBXFindMatchStyle"), CFSTR("com.apple.Xcode"));
id nsMatchStyle = [(id)matchStyle copy];
if (matchStyle) {
CFRelease(matchStyle);
}
return [nsMatchStyle autorelease];
}
or is this just a false positive, given that the copied object is toll-free bridged?