I use the KeyChainItemWrapper from the Apple code example to store the user password for authentication, but when I call it to set the password:
[keychain setObject:passwordField.text forKey:(id)kSecValueData]
It pumps memory leaks all over my shirt. The problem apparently traces back to line 274 in KeyChainItemWrapper.m, which is this:
if (SecItemCopyMatching((CFDictionaryRef)genericPasswordQuery, (CFTypeRef *)&attributes) == noErr)
{
How can I fix this, and should I be more careful when working with sample Apple code in the future?
Note. I can post more code, but I narrowed the problem down to this line using tools, and a complete sample code is easily accessible to any developer.
source
share