Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 046517343c9de94cf783afc8120453edc35f3592
      
https://github.com/WebKit/WebKit/commit/046517343c9de94cf783afc8120453edc35f3592
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M 
Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp

  Log Message:
  -----------
  LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded() 
leaks an AudioComponentInstance on every post-creation error path
https://bugs.webkit.org/show_bug.cgi?id=320048
rdar://182985963

Reviewed by Youenn Fablet.

Once AudioComponentInstanceNew() succeeds, createAudioUnitIfNeeded()
configures the new AudioComponentInstance through a series of
AudioUnitSetProperty()/AudioUnitGetProperty()/AudioUnitInitialize()
calls, each followed by an early return on failure. None of those
early returns disposed the instance first, so any failure after
creation leaked an AudioUnit/HAL resource; only the final success
path assigned it to m_remoteIOUnit for later cleanup in stop().
Since createAudioUnitIfNeeded() can be retried, a persistently
failing configuration step would leak a new instance on every call.

Used a WTF::ScopeExit to dispose of remoteIOUnit on any early return
after AudioComponentInstanceNew() succeeds, releasing the ScopeExit
right before the final successful assignment to m_remoteIOUnit.

No new tests, since this path only leaks a HAL resource and cannot
be detected by output-diffing LayoutTests/WPT; there's no mock layer
for the CoreAudio calls exercised here.

* 
Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp:
(WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):

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



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

Reply via email to