[vlc-commits] keychain: create secretData only when needed
Thomas Guillem
git at videolan.org
Thu Nov 14 15:24:08 CET 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov 4 16:32:57 2019 +0100| [23cc81c8e0cf1969b4e64225a7e7865a1ea408b2] | committer: Thomas Guillem
keychain: create secretData only when needed
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=23cc81c8e0cf1969b4e64225a7e7865a1ea408b2
---
modules/keystore/keychain.m | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/keystore/keychain.m b/modules/keystore/keychain.m
index f92c30a583..2e00f31f90 100644
--- a/modules/keystore/keychain.m
+++ b/modules/keystore/keychain.m
@@ -395,8 +395,6 @@ static int Store(vlc_keystore *p_keystore,
/* search */
status = SecItemCopyMatching((__bridge CFDictionaryRef)searchQuery, &result);
- /* create storage unit */
- NSData *secretData = [NSData dataWithBytes:p_secret length:i_secret_len];
if (status == errSecSuccess) {
msg_Dbg(p_keystore, "the item was already known to keychain, so it will be updated");
@@ -404,6 +402,7 @@ static int Store(vlc_keystore *p_keystore,
query = [[NSMutableDictionary alloc] init];
/* just set the secret data */
+ NSData *secretData = [NSData dataWithBytes:p_secret length:i_secret_len];
[query setObject:secretData forKey:(__bridge id)kSecValueData];
[query setObject:@(kVlc4Creator) forKey:(__bridge id)kSecAttrCreator];
@@ -420,6 +419,7 @@ static int Store(vlc_keystore *p_keystore,
SetAccessibilityForQuery(p_keystore, query);
/* set secret data */
+ NSData *secretData = [NSData dataWithBytes:p_secret length:i_secret_len];
[query setObject:secretData forKey:(__bridge id)kSecValueData];
[query setObject:@(kVlc4Creator) forKey:(__bridge id)kSecAttrCreator];
More information about the vlc-commits
mailing list