Closed
Bug 71005
Opened 24 years ago
Closed 23 years ago
Memory leak in implementation of nsJARURI
Categories
(Core :: Networking, defect, P4)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla0.9.8
People
(Reporter: marcus.webster, Assigned: darin.moz)
Details
(Keywords: memory-leak, perf)
Attachments
(3 files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
gordon
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
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
Updated•24 years ago
|
Updated•23 years ago
|
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Comment 3•23 years ago
|
||
Assign the results of the Queryinterface to a nsCOMPtr<nsIJARURI>.
Assignee | ||
Comment 5•23 years ago
|
||
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+
Assignee | ||
Comment 6•23 years ago
|
||
vinay: your patch needs work
Comment 7•23 years ago
|
||
Assignee | ||
Comment 8•23 years ago
|
||
vinay: wrong patch :P
Comment 9•23 years ago
|
||
Opps - attaching the new patch file.
Sorry for the confusion.
Assignee | ||
Updated•23 years ago
|
Attachment #60469 -
Flags: superreview+
Assignee | ||
Comment 10•23 years ago
|
||
Comment on attachment 60469 [details] [diff] [review]
correct patch
sr=darin
Assignee | ||
Comment 11•23 years ago
|
||
Comment on attachment 60469 [details] [diff] [review]
correct patch
sr=darin
Comment 12•23 years ago
|
||
Comment on attachment 60469 [details] [diff] [review]
correct patch
Looks good. r=gordon.
Attachment #60469 -
Flags: review+
Assignee | ||
Comment 13•23 years ago
|
||
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.
Description
•