Closed Bug 1332233 Opened 8 years ago Closed 8 years ago

[Static Analysis][Resource leak] In function CustomElementRegistry::Define

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1397481)

Attachments

(1 file)

The Static Analysis tool Coverity detected that a resource leak can happen in the following context:

>>   CustomElementDefinition* definition =
>>     new CustomElementDefinition(nameAtom,
>>                                 localNameAtom,
>>                                 constructor,
>>                                 constructorPrototype,
>>                                 callbacks,
>>                                 0 /* TODO dependent on HTML imports. Bug 877072 */);
>> 
>>   /**
>>    * 12. Add definition to this CustomElementRegistry.
>>    */
>>   if (!mConstructors.put(constructorUnwrapped, nameAtom)) {
>>     aRv.Throw(NS_ERROR_FAILURE);
>>     return;
>>   }

I think we should allocate definition after the if statement.
Comment on attachment 8828303 [details]
Bug 1332233 - prevent resource leak in CustomElementRegistry::Define.

https://reviewboard.mozilla.org/r/105764/#review106654
Attachment #8828303 - Flags: review?(amarchesini) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/335c864df46d
prevent resource leak in CustomElementRegistry::Define. r=baku
https://hg.mozilla.org/mozilla-central/rev/335c864df46d
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: