Closed Bug 58736 Opened 24 years ago Closed 24 years ago

nsHTTPIndex::CommonInit leaks RDFServiceImpl

Categories

(SeaMonkey :: UI Design, defect, P3)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: mozilla)

Details

(Keywords: memory-leak, Whiteboard: [tind-mlk])

Attachments

(4 files)

nsHTTPIndex::CommonInit leaks references to the RDFService when called multiple times, since it does a GetService into a global that can already contain an owning reference. This leak was introduced in revision 1.51 on August 14 to fix bug 47927.
Keywords: mlk
Whiteboard: [tind-mlk]
If you don't want to do any other cleanup of |Init| and |CommonInit|, and you think that patch is right, feel free to review the patch and assign the bug to me...
QA Contact: sairuh → tever
Due to the nature of nsDirectoryViewer where it can act both as a singleton and not, the RDF service variable shouldn't be a shared global; instead, make it a method variable. dbaron, care to try out the attached diff(s) ?
Status: NEW → ASSIGNED
Oops, no need for nsServiceManager::ReleaseService() when using do_GetService... so use second diff for nsDirectoryViewer.cpp
Patch works fine -- doesn't leak. A few comments: * weird whitespace stuff going on. Looks like tabs->spaces in some places and spaces->tabs in others. I guess it should probably be tabs->spaces (but you don't need to hit stuff you didn't change otherwise). * No need to null out the nsCOMPtr in the destructor - it will be freed at the end of the dtor anyway. * You can use do_GetService(..., &rv) to propagate the return value the way you did before, rather than make up NS_ERROR_NULL_POINTER. With that fixed, r=dbaron if you want it.
Chris (Waterson), more r= bug love needed. :)
[r,sr]=waterson, pick one!
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
verified
Product: Core → Mozilla Application Suite
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: