@@ -30,7 +30,7 @@ actual open class KVault(
3030 * If the bundle identifier is nil, it will fallback to `com.liftric.KVault`.
3131 */
3232 @Deprecated(" Will be removed in a future version, please use the primary constructor. Check your service name before migrating." )
33- constructor (): this (Constants .BundleIdentifier , null )
33+ constructor () : this (Constants .BundleIdentifier , null )
3434
3535 // ===============
3636 // SET OPERATIONS
@@ -255,7 +255,6 @@ actual open class KVault(
255255 CFDictionaryAddValue (query, kSecClass, kSecClassGenericPassword)
256256 CFDictionaryAddValue (query, kSecAttrAccount, CFBridgingRetain (key))
257257 CFDictionaryAddValue (query, kSecValueData, CFBridgingRetain (value))
258-
259258 return if (existsObject(key)) {
260259 update(value, key)
261260 } else {
@@ -269,14 +268,12 @@ actual open class KVault(
269268 CFDictionaryAddValue (query, kSecAttrAccount, CFBridgingRetain (forKey))
270269 CFDictionaryAddValue (query, kSecReturnData, kCFBooleanTrue)
271270 CFDictionaryAddValue (query, kSecMatchLimit, kSecMatchLimitOne)
272-
273271 memScoped {
274272 val result = alloc<CFTypeRefVar >()
275273 if (perform(Operation .Get , query, result)) {
276274 return CFBridgingRelease (result.value) as NSData
277275 }
278276 }
279-
280277 return null
281278 }
282279
@@ -315,6 +312,8 @@ actual open class KVault(
315312 Operation .Update -> SecItemUpdate (query, updateQuery)
316313 Operation .Delete -> SecItemDelete (query)
317314 }
315+ CFRelease (query)
316+ updateQuery?.let { CFRelease (it) }
318317
319318 return if (status.toUInt() == noErr) {
320319 true
0 commit comments