From 0c38a6ca2d410d2d65bff891d40e639ed450c802 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Wed, 17 Jul 2013 10:20:48 -0700 Subject: [PATCH] Fixing static analyzer warnings about CFRelease calls to NULL pointer --- AFNetworking/AFURLConnectionOperation.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index dadcb25..58c305e 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -244,9 +244,10 @@ static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { [publicKeys addObject:(__bridge_transfer id)allowedPublicKey]; } } - } - - CFRelease(allowedTrust); + + CFRelease(allowedTrust); + } + CFRelease(policy); CFRelease(certificates); CFRelease(allowedCertificate); @@ -605,9 +606,10 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe if (status == errSecSuccess) { [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; } + + CFRelease(trust); } - CFRelease(trust); CFRelease(certificates); } }