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.
sr=mscott. thanks for the code contribution!
Fixed and checked in. Thanks Kevin Higgins.
David, can you please verify this. Thanks!