WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
186152
Fix leak of AudioDeviceID array due to an early return in AudioDeviceMac::GetNumberDevices()
https://bugs.webkit.org/show_bug.cgi?id=186152
Summary
Fix leak of AudioDeviceID array due to an early return in AudioDeviceMac::Get...
David Kilzer (:ddkilzer)
Reported
2018-05-31 11:19:16 PDT
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
>
Attachments
Patch v1
(5.57 KB, patch)
2018-05-31 11:34 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Patch v2
(5.65 KB, patch)
2018-05-31 12:04 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Patch v3
(5.53 KB, patch)
2018-05-31 12:11 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-05-31 11:26:07 PDT
<
rdar://problem/40692824
>
David Kilzer (:ddkilzer)
Comment 2
2018-05-31 11:34:05 PDT
Created
attachment 341679
[details]
Patch v1
Alex Christensen
Comment 3
2018-05-31 11:39:28 PDT
Comment on
attachment 341679
[details]
Patch v1 Can't we use std::make_unique?
David Kilzer (:ddkilzer)
Comment 4
2018-05-31 12:03:31 PDT
(In reply to Alex Christensen from
comment #3
)
> Comment on
attachment 341679
[details]
> Patch v1 > > Can't we use std::make_unique?
I was aiming to change the code as little as possible, but yes we can! New patch forthcoming.
David Kilzer (:ddkilzer)
Comment 5
2018-05-31 12:04:03 PDT
Created
attachment 341681
[details]
Patch v2
David Kilzer (:ddkilzer)
Comment 6
2018-05-31 12:11:24 PDT
Created
attachment 341684
[details]
Patch v3 Remove 'const' from 'numberDevices' since it used in an in-out context in AudioObjectGetPropertyData().
WebKit Commit Bot
Comment 7
2018-05-31 12:51:35 PDT
Comment on
attachment 341684
[details]
Patch v3 Clearing flags on attachment: 341684 Committed
r232365
: <
https://trac.webkit.org/changeset/232365
>
WebKit Commit Bot
Comment 8
2018-05-31 12:51:37 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug