Closed Bug 66438 Opened 25 years ago Closed 25 years ago

status string leaked during composition

Categories

(MailNews Core :: Composition, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.8

People

(Reporter: dbaron, Assigned: bugzilla)

Details

(Keywords: memory-leak)

Attachments

(1 file)

While writing a message from a mailto: link, the Boehm GC said the a string was leaked allocated from: PR_Malloc nsMemoryImpl::Alloc(unsigned int) nsMemory::Alloc(unsigned int) nsCppSharedAllocator::allocate(unsigned int, void const *) nsCRT::strndup(unsigned wchar_t const *, unsigned int) nsCRT::strdup(unsigned wchar_t const *) nsMsgComposeAndSend::SetStatusMessage(unsigned wchar_t const *) nsMsgComposeAndSend::Init(nsIMsgIdentity *, nsMsgCompFields *, nsFileSpec *, int, int, int, nsIMessage *, char const *, char const *, unsigned int, nsMsgAttachmentData const *, nsMsgAttachedFile const *) nsMsgComposeAndSend::CreateAndSendMessage(nsIEditorShell *, nsIMsgIdentity *, nsIMsgCompFields *, int, int, int, nsIMessage *, char const *, char const *, unsigned int, nsMsgAttachmentData const *, nsMsgAttachedFile const *, void *, nsIMsgSendListener **, unsigned int) nsMsgCompose::_SendMsg(int, nsIMsgIdentity *, int) nsMsgCompose::SendMsg(int, nsIMsgIdentity *) XPTC_InvokeByIndex It looks like the problem is that nsMsgComposeAndSend::SetStatusMessage does an unnecessary strdup and never frees the result. AFAICT, that stdrup should just be removed and you should use aMsgString directly. Also, while I'm here, I'll point out that nsMsgStatusFeedback::ShowStatusString is also inefficient: the nsAutoString is unnecessary and could be removed (it's never used).
Attached patch proposed fix — — Splinter Review
The above patch fixes the leak in nsMsgComposeAndSend::SetStatusMessage and removes the unused nsAutoString in nsMsgStatusFeedback::ShowStatusString (as per dbaron's comments). Can someone look at this for an r/sr=?
Right thing to do. R=ducarroz. Please send an email to reviewers@mozilla.org and mscott@netscape.com for a super review. Good job. Once you get the SR, I'll check in the patch for you.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.8
sr=mscott. thanks for the code contribution!
Fixed and checked in. Thanks Kevin Higgins.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
David, can you please verify this. Thanks!
QA Contact: esther → stephend
verified fixed.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: