Closed Bug 71005 Opened 24 years ago Closed 23 years ago

Memory leak in implementation of nsJARURI

Categories

(Core :: Networking, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.8

People

(Reporter: marcus.webster, Assigned: darin.moz)

Details

(Keywords: memory-leak, perf)

Attachments

(3 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; 0.8) Gecko/20010215 BuildID: 2001021508 Look in function nsJARURI::Equals the URI passed to the argument is QueryInterface'd to a nsIJARURI and assigned to a plain old nsIJARURI pointer, otherJar - not an nsCOMPtr. The reference is then never released. Reproducible: Didn't try Steps to Reproduce: I have read the code - I have not tried to measure how much memory this code is leaking. The questionable code is at... http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/jar/src/nsJARURI.cpp#255
Keywords: mlk, perf
Marking NEW.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → mozilla0.9.3
mass move, v2. qa to me.
QA Contact: tever → benc
Priority: -- → P4
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Target Milestone: mozilla0.9.4 → mozilla0.9.6
Blocks: 92580
No longer blocks: 92580
Target Milestone: mozilla0.9.6 → mozilla0.9.8
Attached patch proposed fix (deleted) — Splinter Review
Assign the results of the Queryinterface to a nsCOMPtr<nsIJARURI>.
to darin for review of patch
Assignee: neeti → darin
Comment on attachment 60313 [details] [diff] [review] proposed fix >Index: src/nsJARURI.cpp >- nsJARURI* otherJAR; >- rv = other->QueryInterface(NS_GET_IID(nsIJARURI), (void**)&otherJAR); >+ nsCOMPtr<nsIJARURI> otherJAR = nsnull; >+ nsJARURI* tempPtr = nsnull; >+ rv = other->QueryInterface(NS_GET_IID(nsIJARURI), (void**)&tempPtr); > if (NS_FAILED(rv)) > return NS_OK; // not equal >+ else >+ otherJAR = tempPtr; actually, this doesn't fix the leak. tempPtr still holds a reference, and assignment into a COMPtr adds one more reference. the correct solution would be something like this: nsCOMPtr<nsIJARURI> otherJAR( do_QueryInterface(other, &rv) ); if (NS_FAILED(rv)) return rv;
Attachment #60313 - Flags: needs-work+
vinay: your patch needs work
vinay: wrong patch :P
Attached patch correct patch (deleted) — Splinter Review
Opps - attaching the new patch file. Sorry for the confusion.
Attachment #60469 - Flags: superreview+
Comment on attachment 60469 [details] [diff] [review] correct patch sr=darin
Comment on attachment 60469 [details] [diff] [review] correct patch sr=darin
Comment on attachment 60469 [details] [diff] [review] correct patch Looks good. r=gordon.
Attachment #60469 - Flags: review+
fix checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: