Closed
Bug 69256
Opened 24 years ago
Closed 24 years ago
nsMsgNewsFolder::UpdateSummaryFromNNTPInfo leaks nsMsgKeySet
Categories
(MailNews Core :: Networking: NNTP, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: dbaron, Assigned: hwaara)
Details
(Keywords: memory-leak)
Attachments
(3 files)
874 bytes,
patch
|
Details | Diff | Splinter Review | |
1022 bytes,
patch
|
Details | Diff | Splinter Review | |
773 bytes,
patch
|
Details | Diff | Splinter Review |
When I start the main mail window with "./mozilla -mail" and exit, nsMsgNewsFolder::UpdateSummaryFromNNTPInfo leaks an nsMsgKeySet allocated at: http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/mailnews/news/src/nsNewsFolder.cpp&rev=1.159&mark=792#782 It looks like there just isn't any provision for deleting |set| if it was created rather than obtained from |mDatabase|
Assignee | ||
Updated•24 years ago
|
OS: Linux → All
Assignee | ||
Comment 1•24 years ago
|
||
I discussed this with David Bienvenu, patch coming up.
Assignee: sspitzer → hwaara
Assignee | ||
Comment 2•24 years ago
|
||
Assignee | ||
Comment 3•24 years ago
|
||
This patch fixes two problems: * If /setStr/ was null, then we wouldn't go ahead and delete /newsrcHasChanged/. I don't know if this was a bug or a feature, but I think it's safe to check if /newsrcHasChanged/ exists even though /setStr/ is null. * My patch also fixes so we delete /set/ if mDatabase was null. Because, as dbaron pointed out - if mDatabase is null, we execute code which takes /set/ and does ::Create on it. If we create a new object, we're responsible for deleteing it. So we have to do that at the end of this function if /set/ is non- null. This was the leak. I think this patch is ready for r= and sr=, dbaron, bienvenu?
Comment 4•24 years ago
|
||
adding myself back to the bug list. (feel free to take my bugs, but please keep me on the cc list.)
Comment 5•24 years ago
|
||
you don't need to check if set is null before calling the delete operator - delete handles the null case. So, the change can just be "delete set;"
Assignee | ||
Comment 6•24 years ago
|
||
Comment 7•24 years ago
|
||
r=bienvenu - I don't think the change with checking newsrchaschanged even if setstr is null will have any affect but I don't think it causes any harm.
Comment 8•24 years ago
|
||
newsrcHasChanged can only be true if setStr is non-null. the only place we set it to true is wrapped with "if (setStr && nsCRT::strcmp(setStr, oldSet))" so your change adds an extra check (in the case that setStr is null) that will never pass. the other part of the fix (adding "delete set;") is correct. thanks for catching that. please supply a new patch.
Assignee | ||
Comment 9•24 years ago
|
||
I was thinking that sometime someone might use newsrcHasChanged in another place in that function too, and that day we'll probably also leak newsrcHasChanged if it depends on setStr.
Assignee | ||
Comment 10•24 years ago
|
||
Comment 11•24 years ago
|
||
sr=bienvenu (style point: there's no need for the extra blank lines you've inserted - they make it harder to read the code because you can see less actual code at once)
Comment 12•24 years ago
|
||
r=sspitzer. please check in without the newlines, as bienvenu suggests.
Comment 13•24 years ago
|
||
fix checked in according to bienvenu and modeline.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 14•23 years ago
|
||
Can someone with a leak detector verify that this bug doesn't occur any longer, dbaron?
Status: RESOLVED → VERIFIED
Updated•20 years ago
|
Product: MailNews → Core
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•