Closed Bug 1410689 Opened 2 years ago Closed 2 years ago

[CID 1419987] Leak in GMPContentChild::RecvPChromiumCDMConstructor()

Categories

(Core :: Audio/Video: GMP, defect)

55 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox-esr52 --- unaffected
firefox56 --- unaffected
firefox57 --- unaffected
firefox58 --- fixed

People

(Reporter: jesup, Assigned: JamesCheng)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak, Whiteboard: [CID 1419987])

Attachments

(1 file)

If err isn'g GMPNoErr, we'll leak a cdm structure.  I suggest moving the 'if' up to before 'new'.


** CID 1419987:  Resource leaks  (RESOURCE_LEAK)
/dom/media/gmp/GMPContentChild.cpp: 303 in mozilla::gmp::GMPContentChild::RecvPChromiumCDMConstructor(mozilla::gmp::PChromiumCDMChild *)()


________________________________________________________________________________________________________
*** CID 1419987:  Resource leaks  (RESOURCE_LEAK)
/dom/media/gmp/GMPContentChild.cpp: 303 in mozilla::gmp::GMPContentChild::RecvPChromiumCDMConstructor(mozilla::gmp::PChromiumCDMChild *)()
297         cdm =
298           new ChromiumCDM8BackwardsCompat(
299             host9,
300             static_cast<cdm::ContentDecryptionModule_8*>(cdm));
301         if (err != GMPNoErr) {
302           NS_WARNING("GMPGetAPI call failed trying to get CDM.");
>>>     CID 1419987:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "cdm" going out of scope leaks the storage it points to.
303           return IPC_FAIL_NO_REASON(this);
304         }
305       }
306     
307       child->Init(static_cast<cdm::ContentDecryptionModule_9*>(cdm));
308
Thank you, I will fix it soon.
Summary: Leak in GMPContentChild::RecvPChromiumCDMConstructor() → [CID 1419987] Leak in GMPContentChild::RecvPChromiumCDMConstructor()
Comment on attachment 8920932 [details]
Bug 1410689 - Early return before creating ChromiumCDM8BackwardsCompat to avoid leak.

https://reviewboard.mozilla.org/r/191872/#review197046
Attachment #8920932 - Flags: review?(gsquelart) → review+
Pushed by jacheng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d936c6da5ff3
Early return before creating ChromiumCDM8BackwardsCompat to avoid leak. r=gerald
https://hg.mozilla.org/mozilla-central/rev/d936c6da5ff3
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Keywords: coverity
Whiteboard: [CID 1419987]
You need to log in before you can comment on or make changes to this bug.