Bug 224349

Summary: [macOS] WebProcessProxy::sendAudioComponentRegistrations leaks CFDataRef
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, jer.noble, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Eric Carlson 2021-04-08 16:41:24 PDT
WebProcessProxy::sendAudioComponentRegistrations leaks CFDataRef
Comment 1 Eric Carlson 2021-04-08 16:42:30 PDT
<rdar://problem/76176827>
Comment 2 Eric Carlson 2021-04-08 16:58:28 PDT
Created attachment 425561 [details]
Patch
Comment 3 EWS 2021-04-08 17:39:23 PDT
Committed r275735 (236322@main): <https://commits.webkit.org/236322@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 425561 [details].
Comment 4 Darin Adler 2021-04-09 10:10:46 PDT
Comment on attachment 425561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=425561&action=review

> Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:299
> +        RunLoop::main().dispatch([protectedThis = WTFMove(protectedThis), registrations = adoptCF(registrations)] () mutable {

We always try to keep the adoptCF as close as possible to the call that returns the retained object. Here it’s pretty close, but so easy to miss! I kind of wish there was a more straightforward way to write this. On the other hand this is clearly correct code that does the right thing now.