Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 12b5e059d376502dcaf63f1e3643106910a84db9
      
https://github.com/WebKit/WebKit/commit/12b5e059d376502dcaf63f1e3643106910a84db9
  Author: David Kilzer <[email protected]>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm
    M Source/WebKit/Shared/cf/CoreIPCSecTrust.mm
    M 
Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorUtils.mm
    M Tools/TestWebKitAPI/Tests/IPC/IPCSerialization.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Challenge.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebTransport.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/_WKWebAuthenticationPanel.mm
    M Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

  Log Message:
  -----------
  Fix leaks from Security APIs by using adoptCF() for CFErrorRef out parameters
<https://bugs.webkit.org/show_bug.cgi?id=312411>
<rdar://174864243>

Reviewed by Chris Dumez.

Several Security framework APIs return +1 retained `CFErrorRef`
objects through their out parameters, but are missing the
`CF_RETURNS_RETAINED` annotation.

Adopt each raw `CFErrorRef` into a `RetainPtr` using a scoped
block to limit the raw pointer's lifetime, preventing accidental
use after `adoptCF()` takes ownership.  Also adopt other CF
objects returned by Copy/Create APIs with `RetainPtr` to
eliminate manual `CFRelease()` calls.

Test using `run-webkit-tests --leaks`.

* Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(WebKit::transformTrustToData):
(WebKit::transformDataToTrust):
* Source/WebKit/Shared/cf/CoreIPCSecTrust.mm:
(WebKit::CoreIPCSecTrust::CoreIPCSecTrust):
(WebKit::CoreIPCSecTrust::createSecTrust const):
* 
Source/WebKit/UIProcess/WebAuthentication/Virtual/VirtualAuthenticatorUtils.mm:
(WebKit::createPrivateKey):
(WebKit::privateKeyFromBase64):

* Tools/TestWebKitAPI/Tests/IPC/IPCSerialization.mm:
(secTrustRefsEqual):
- Adopt `SecTrustCopyExceptions()` and
  `CFPropertyListCreateWithData()` return values with
  `RetainPtr` to fix leaks.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/Challenge.mm:
(createTestIdentity):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebTransport.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/_WKWebAuthenticationPanel.mm:
(addKeyToKeychain):
* Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::addTestKeyToKeychain):

Canonical link: https://commits.webkit.org/311454@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to