获取'存储在......中的对象的潜在泄漏。尽管使用CFBridgingRelease()

时间:2016-05-12 10:51:04

标签: objective-c core-foundation clang-static-analyzer

以下代码使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;

仪器中的分析确实表明内存已泄露。有人可以解释原因吗?

0 个答案:

没有答案