Closed
Bug 999072
Opened 11 years ago
Closed 11 years ago
MediaManager GetCharPref("media.video_loopback_dev") leaks strings in DEBUG build
Categories
(Core :: WebRTC: Audio/Video, defect)
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: jib, Assigned: ted)
References
Details
Attachments
(1 file)
7.21 KB,
patch
|
jesup
:
review+
|
Details | Diff | Splinter Review |
From http://hg.mozilla.org/mozilla-central/rev/622e6c1191eb :
> + char* loopbackAudioDevice = nullptr;
> + char* loopbackVideoDevice = nullptr;
> + nsresult rv;
> +#ifdef DEBUG
> + // Check if the preference for using loopback devices is enabled.
> + nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
> + if (NS_SUCCEEDED(rv)) {
> + nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
> + if (branch) {
> + branch->GetCharPref("media.audio_loopback_dev", &loopbackAudioDevice);
> + branch->GetCharPref("media.video_loopback_dev", &loopbackVideoDevice);
> + }
> + }
> +#endif
GetCharPref returns an NS_strdup() which is never released (twice here per call).
Should use getter_Copies.
It only leaks if you set one or both of the loopback values in about:config - they aren't normally set - and only in DEBUG.
Assignee | ||
Comment 1•11 years ago
|
||
This fixes the leak by way of switching to Preferences::GetCString, and also enables this code in non-debug builds since I want to use it for bug 815002.
Attachment #8416491 -
Flags: review?(rjesup)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → ted
Status: NEW → ASSIGNED
Updated•11 years ago
|
Attachment #8416491 -
Flags: review?(rjesup) → review+
Assignee | ||
Comment 2•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in
before you can comment on or make changes to this bug.
Description
•