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).
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 email@example.com and firstname.lastname@example.org 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: 19 years ago
Resolution: --- → FIXED
David, can you please verify this. Thanks!
QA Contact: esther → stephend
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.