Title: [284319] trunk/Source/WebKit
Revision
284319
Author
[email protected]
Date
2021-10-16 11:16:53 -0700 (Sat, 16 Oct 2021)

Log Message

WebKit::LocalConnection::createCredentialPrivateKey leaks an NSMutableDictionary
<https://webkit.org/b/231814>
<rdar://problem/84307054>

Reviewed by Kate Cheney.

* UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
(WebKit::LocalConnection::createCredentialPrivateKey const):
- Use RetainPtr<> and adoptNS to fix the leak.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (284318 => 284319)


--- trunk/Source/WebKit/ChangeLog	2021-10-16 17:16:15 UTC (rev 284318)
+++ trunk/Source/WebKit/ChangeLog	2021-10-16 18:16:53 UTC (rev 284319)
@@ -1,3 +1,15 @@
+2021-10-16  David Kilzer  <[email protected]>
+
+        WebKit::LocalConnection::createCredentialPrivateKey leaks an NSMutableDictionary
+        <https://webkit.org/b/231814>
+        <rdar://problem/84307054>
+
+        Reviewed by Kate Cheney.
+
+        * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
+        (WebKit::LocalConnection::createCredentialPrivateKey const):
+        - Use RetainPtr<> and adoptNS to fix the leak.
+
 2021-10-16  Lauro Moura  <[email protected]>
 
         [GTK4] Update signal name to monitor window resize

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm (284318 => 284319)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm	2021-10-16 17:16:15 UTC (rev 284318)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm	2021-10-16 18:16:53 UTC (rev 284319)
@@ -167,7 +167,7 @@
 
 RetainPtr<SecKeyRef> LocalConnection::createCredentialPrivateKey(LAContext *context, SecAccessControlRef accessControlRef, const String& secAttrLabel, NSData *secAttrApplicationTag) const
 {
-    NSDictionary *privateKeyAttributes = @{
+    RetainPtr privateKeyAttributes = @{
         (id)kSecAttrAccessControl: (id)accessControlRef,
         (id)kSecAttrIsPermanent: @YES,
         (id)kSecAttrAccessGroup: (id)String(LocalAuthenticatiorAccessGroup),
@@ -176,8 +176,8 @@
     };
 
     if (context) {
-        privateKeyAttributes = [privateKeyAttributes mutableCopy];
-        ((NSMutableDictionary *)privateKeyAttributes)[(id)kSecUseAuthenticationContext] = context;
+        privateKeyAttributes = adoptNS([privateKeyAttributes mutableCopy]);
+        ((NSMutableDictionary *)privateKeyAttributes.get())[(id)kSecUseAuthenticationContext] = context;
     }
 
     NSDictionary *attributes = @{
@@ -184,7 +184,7 @@
         (id)kSecAttrTokenID: (id)kSecAttrTokenIDSecureEnclave,
         (id)kSecAttrKeyType: (id)kSecAttrKeyTypeECSECPrimeRandom,
         (id)kSecAttrKeySizeInBits: @256,
-        (id)kSecPrivateKeyAttrs: privateKeyAttributes,
+        (id)kSecPrivateKeyAttrs: privateKeyAttributes.get(),
     };
 
     LOCAL_CONNECTION_ADDITIONS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to