Closed Bug 1785003 Opened 2 years ago Closed 2 years ago

resource leak in nsImapMailFolder::CompactAll

Categories

(MailNews Core :: Networking: IMAP, defect)

defect

Tracking

(thunderbird_esr102 unaffected)

RESOLVED FIXED
105 Branch
Tracking Status
thunderbird_esr102 --- unaffected

People

(Reporter: mkmelin, Assigned: mkmelin)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

*** CID 1507881: Resource leaks (RESOURCE_LEAK)
/comm/mailnews/imap/src/nsImapMailFolder.cpp: 1420 in nsImapMailFolder::CompactAll(nsIUrlListener *, nsIMsgWindow *)()
1414 rv = imapFolder->Expunge(l, aMsgWindow);
1415 if (NS_FAILED(rv)) {
1416 // Make sure expungeCount is kept in sync!
1417 l->OnStopRunningUrl(nullptr, rv);
1418 }
1419 }

CID 1507881:  Resource leaks  (RESOURCE_LEAK)
Variable "l" going out of scope leaks the storage it points to.

1420 } else {
1421 // No expunging. Start the compaction immediately.
1422 doCompact();
1423 }
1424
1425 return NS_OK;

Ahh... I think that's the static analysis not realising the listener if refcounted by the compact operations - it'll be destroyed automagically when the last compact finishes. It would be a leak if the folder list was empty. There's a check for that no-folders case, but I think your fix adding an extra explicit refptr is definitely the right way to go - thanks for that!

Target Milestone: --- → 105 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/723c4ec60cc9
Fix resource leak in nsImapMailFolder::CompactAll. r=benc

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: