Open Bug 112341 Opened 23 years ago Updated 2 years ago

MLK: Memory leak of 144 bytes from 1 block allocated in PL_strdup

Categories

(MailNews Core :: MIME, defect)

x86
Windows NT
defect

Tracking

(Not tracked)

People

(Reporter: naving, Unassigned)

References

Details

(Keywords: memory-leak)

Attachments

(1 file)

Again fwding as inline....

        Distribution of leaked blocks
        Allocation location
        malloc         [dbgheap.c:129]
        PL_strdup      [strdup.c:46]
        nsCRT::strdup(char const*) [nsCRT.h:182]
        mime_bridge_create_draft_stream [mimedrft.cpp:2016]
            PR_FREEIF(mdd);
            return nsnull;
          }
     => 
          mdd->options->url = nsCRT::strdup(mdd->url_name);
          mdd->options->format_out = format_out;     // output format
          mdd->options->decompose_file_p = PR_TRUE; /* new field in 
MimeDisplayOptions */
        bridge_create_stream [nsStreamConverter.cpp:101]
        {
          if  ( (format_out == nsMimeOutput::nsMimeMessageDraftOrTemplate) ||
                (format_out == nsMimeOutput::nsMimeMessageEditorTemplate) )
     =>     return mime_bridge_create_draft_stream(newEmitter, newPluginObj2, 
uri, format_out);
          else
            return mime_bridge_create_display_stream(newEmitter, newPluginObj2, 
uri, format_out, whattodo,
                                                     aChannel);
        nsStreamConverter::Init(nsIURI *,nsIStreamListener *,nsIChannel *) 
[nsStreamConverter.cpp:740]
            return NS_OK;
          else
          {
     =>     mBridgeStream = bridge_create_stream(mEmitter, this, aURI, newType, 
whattodo, aChannel);
                        if (!mBridgeStream)
                          return NS_ERROR_OUT_OF_MEMORY;
                        else
                nsStreamConverter::AsyncConvertData(WORD const*,WORD 
const*,nsIStreamListener *,nsISupports *) [nsStreamConverter.cpp:1117]
                    
                        nsCOMPtr<nsIURI> aUri;
                        aChannel->GetURI(getter_AddRefs(aUri));
                 =>     return Init(aUri, aListener, aChannel);
                    }
                    
                    NS_IMETHODIMP nsStreamConverter::FirePendingStartRequest()
                nsMsgDraft::ProcessDraftOrTemplateOperation(char 
const*,int,nsIMsgIdentity *,nsIMsgDBHdr * *,nsIMsgWindow *) 
[nsMsgCreate.cpp:178]
                    
                      nsCOMPtr<nsIChannel> dummyChannel;
                      rv = 
NS_NewInputStreamChannel(getter_AddRefs(dummyChannel), aURL, nsnull, nsnull, 
-1);
                 =>   if (NS_FAILED(mimeParser->AsyncConvertData(nsnull, nsnull, 
nsnull, dummyChannel)))
                      {
                        Release();
                        mMessageService = nsnull;
                nsMsgDraft::OpenDraftMsg(char const*,nsIMsgDBHdr * 
*,nsIMsgIdentity *,int,nsIMsgWindow *) [nsMsgCreate.cpp:216]
                    
                      mAddInlineHeaders = addInlineHeaders;
                      return ProcessDraftOrTemplateOperation(msgURI, 
nsMimeOutput::nsMimeMessageDraftOrTemplate,
                 =>                                          identity, 
aMsgToReplace, aMsgWindow);
                    }
                    
                    nsresult
                nsMsgComposeService::OpenComposeWindow(char const*,char 
const*,int,int,nsIMsgIdentity *,nsIMsgWindow *) [nsMsgComposeService.cpp:276]
                          switch(type)
                          {
                            case nsIMsgCompType::ForwardInline:
                 =>             rv = pMsgDraft->OpenDraftMsg(uriToOpen.get(), 
nsnull, identity, PR_TRUE, aMsgWindow);
                              break;
                            case nsIMsgCompType::Draft:
                                rv = pMsgDraft->OpenDraftMsg(uriToOpen.get(), 
nsnull, identity, PR_FALSE, aMsgWindow);
reassigning and cc'ing for reviews for upcoming patch
Assignee: ducarroz → naving
Keywords: mlk
QA Contact: esther → stephend
Attached patch proposed fixSplinter Review
options->url is const char* and never owns the buffer, it seems to always point

to mdd->url_name and I have tested it works.
for example from mimemoz2.cpp:1497 

>  msd->options->url = msd->url_name;





you should run under purify. The owner of the string could free it out from
under you.
Comment on attachment 59490 [details] [diff] [review]
proposed fix

You cannot do that, unless you find a new fix for bug 31207. I know that sound
uggly.
Attachment #59490 - Flags: needs-work+
Status: NEW → ASSIGNED
mass re-assign.
Assignee: naving → sspitzer
Status: ASSIGNED → NEW
Product: MailNews → Core
sorry for the spam.  making bugzilla reflect reality as I'm not working on these bugs.  filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
Filter on "Nobody_NScomTLD_20080620"
QA Contact: stephend → mime
Product: Core → MailNews Core
Severity: normal → minor
Blocks: 110171
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: