以下代码使Xcode的静态分析器变为白痴:
CFErrorRef accessControlError = NULL;
SecAccessControlRef accessControlRef = SecAccessControlCreateWithFlags(
kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlocked,
kSecAccessControlUserPresence,
&accessControlError);
if (accessControlRef == NULL || accessControlError != NULL) {
NSString *fail = CFBridgingRelease(CFErrorCopyDescription(accessControlError));// Bark!
if (error != NULL) {
*error = [TSErrorHandler errorWithCode:TSErrorCodeKeychainACLCreateFailure failureReason:fail];
}
return NO;
}
attributes[(__bridge id)kSecAttrAccessControl] = (__bridge id)accessControlRef;
仪器中的分析确实表明内存已泄露。有人可以解释原因吗?