[Webkit-unassigned] [Bug 186152] New: Fix leak of AudioDeviceID array due to an early return in AudioDeviceMac::GetNumberDevices()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 31 11:19:16 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=186152

            Bug ID: 186152
           Summary: Fix leak of AudioDeviceID array due to an early return
                    in AudioDeviceMac::GetNumberDevices()
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: bfulgham at webkit.org, eric.carlson at apple.com,
                    youennf at gmail.com

Fix leak of AudioDeviceID array due to an early return in AudioDeviceMac::GetNumberDevices():

Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_device/mac/audio_device_mac.cc:1586:3: warning: Potential leak of memory pointed to by 'deviceIds'
  WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(kAudioObjectSystemObject,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_device/mac/audio_device_mac.cc:30:7: note: expanded from macro 'WEBRTC_CA_RETURN_ON_ERR'
      logCAMsg(rtc::LS_ERROR, "Error in " #expr, (const char*)&err); \
      ^~~~~~~~

We can use RAII with std::unique_ptr<>() to fix the leak and remove manual release of the memory using this technique:
<https://www.codeproject.com/Articles/820931/Using-std-unique-ptr-RAII-with-malloc-and-free>

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180531/45123f4b/attachment.html>


More information about the webkit-unassigned mailing list