From 016d3cbe02c58a47c7408a29a1c9b933d0529f2b Mon Sep 17 00:00:00 2001 From: AravinthChandran Date: Mon, 15 Jun 2015 18:01:06 +0530 Subject: [PATCH] Fix static analysis errors . MEMORY_LEAK memory dynamically allocated to query by call to alloc() at line 781, column 35 is not reachable after line 787, column 5 MEMORY_LEAK memory dynamically allocated to query by call to alloc() at line 816, column 35 is not reachable after line 825, column 5 Please enter the commit message for your changes. Lines starting --- Lib/UICKeyChainStore/UICKeyChainStore.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/UICKeyChainStore/UICKeyChainStore.m b/Lib/UICKeyChainStore/UICKeyChainStore.m index 003ccb0..9b3043f 100644 --- a/Lib/UICKeyChainStore/UICKeyChainStore.m +++ b/Lib/UICKeyChainStore/UICKeyChainStore.m @@ -784,7 +784,9 @@ + (NSArray *)allKeysWithItemClass:(UICKeyChainStoreItemClass)itemClass query[(__bridge __strong id)kSecReturnAttributes] = (__bridge id)kCFBooleanTrue; CFArrayRef result = nil; - OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query,(CFTypeRef *)&result); + CFDictionaryRef cfquery = (CFDictionaryRef)CFBridgingRetain(query); + OSStatus status = SecItemCopyMatching(cfquery,(CFTypeRef *)&result); + CFRelease(cfquery); if (status == errSecSuccess) { NSArray *items = [self prettify:itemClassObject items:(__bridge NSArray *)result]; @@ -822,7 +824,9 @@ + (NSArray *)allItemsWithItemClass:(UICKeyChainStoreItemClass)itemClass #endif CFArrayRef result = nil; - OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query,(CFTypeRef *)&result); + CFDictionaryRef cfquery = (CFDictionaryRef)CFBridgingRetain(query); + OSStatus status = SecItemCopyMatching(cfquery,(CFTypeRef *)&result); + CFRelease(cfquery); if (status == errSecSuccess) { return [self prettify:itemClassObject items:(__bridge NSArray *)result];