Closed Bug 1187410 Opened 6 years ago Closed 6 years ago

XPCNativeInterface::NewInstance() leaks a string

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

(Blocks 1 open bug)

Details

(Keywords: memory-leak, Whiteboard: [MemShrink])

Attachments

(1 file)

When NewInstance() finds something that isn't usable in the child process it generates a console message using the following code:
            
char* intfNameChars;
aInfo->GetName(&intfNameChars);

However, it does not free |intfNameChars|, so we leak. The solution is to call GetNameShared() instead of GetName() which does not create copy of the string. |aInfo| should be alive for a long as we need the string (eg the next line) so that should be okay.

This was found by LSan, and shows up in various e10s tests, mostly bc, like toolkit/components/perfmonitoring/tests/browser/ and toolkit/components/addoncompat/tests/browser/.

(This is a regression from bug 997325.)
I haven't done a full try run yet, but this seems pretty benign.
Attachment #8638718 - Flags: review?(mrbkap)
Attachment #8638718 - Flags: review?(mrbkap) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/23952da58da6
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.