Bug 224349 - [macOS] WebProcessProxy::sendAudioComponentRegistrations leaks CFDataRef
Summary: [macOS] WebProcessProxy::sendAudioComponentRegistrations leaks CFDataRef
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-08 16:41 PDT by Eric Carlson
Modified: 2021-04-09 10:10 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.95 KB, patch)
2021-04-08 16:58 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.