Closed Bug 116422 Opened 23 years ago Closed 23 years ago

MLK: Memory leak of 22 bytes from 1 block allocated in PR_Malloc

Categories

(MailNews Core :: Networking: NNTP, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: naving, Assigned: naving)

Details

(Keywords: memory-leak)

Attachments

(1 file, 1 obsolete file)

Cancelling a news message leaks here....

        Distribution of leaked blocks
        Allocation location
        malloc         [dbgheap.c:129]
        PR_Malloc      [prmem.c:54]
        msg_extract_Header_address_mailboxes [nsMsgHeaderParser.cpp:1027]
                size += j + 2;
            }
        
     =>     result = (char*)PR_Malloc(size + 1);
            if (!result)
                        {
                            PR_Free(addrs);
                nsMsgHeaderParser::ExtractHeaderAddressMailboxes(char 
const*,char const*,char * *) [nsMsgHeaderParser.cpp:205]
                          (void) NS_ConvertUTF8toUCS2(line).get(); // asserts if 
invalid UTF-8
                    #endif
                    
                 =>     *mailboxes = msg_extract_Header_address_mailboxes(line);
                        return NS_OK;
                      }
                      else
                nsNNTPProtocol::CheckIfAuthor(nsISupports *,void *) 
[nsNNTPProtocol.cpp:4248]
                    
                        char *us = nsnull;
                        char *them = nsnull;
                 =>     nsresult rv1 = 
parser->ExtractHeaderAddressMailboxes(nsnull, cancelInfo->from, &us);
                        nsresult rv2 = 
parser->ExtractHeaderAddressMailboxes(nsnull, cancelInfo->old_from, &them);
                    
                        PR_LOG(NNTP,PR_LOG_ALWAYS,("us = %s, them = %s", us, 
them));
                nsSupportsArray::EnumerateForwards((*)(nsISupports *,void 
*),void *) [nsSupportsArray.cpp:684]
                      PRBool  running = PR_TRUE;
                    
                      while (running && (++aIndex < (PRInt32)mCount)) {
                 =>     running = (*aFunc)(mArray[aIndex], aData);
                      }
                      return running;
                    }
                nsNNTPProtocol::DoCancel(void) [nsNNTPProtocol.cpp:4361]
                              if (NS_FAILED(rv)) return -1;
                    
                              // CheckIfAuthor will set cancelInfo.from if a 
match is found
                 =>           identities->EnumerateForwards(CheckIfAuthor, (void 
*)&cancelInfo);
                          }
                    
                          if (!cancelInfo.from) {
                nsNNTPProtocol::ProcessProtocolState(nsIURI *,nsIInputStream 
*,UINT,UINT) [nsNNTPProtocol.cpp:5267]
                nsMsgProtocol::OnDataAvailable(nsIRequest *,nsISupports 
*,nsIInputStream *,UINT,UINT) [nsMsgProtocol.cpp:262]
                nsOnDataAvailableEvent::HandleEvent(void) 
[nsStreamListenerProxy.cpp:193]
Keywords: mlk
Summary: [W] MLK: Memory leak of 22 bytes from 1 block allocated in PR_Malloc → MLK: Memory leak of 22 bytes from 1 block allocated in PR_Malloc
Attached patch proposed fix (obsolete) — Splinter Review
free 'us' and 'them'.
Attached patch proposed fixSplinter Review
use nsXPIDLCString for 'us' and 'them'
Attachment #62566 - Attachment is obsolete: true
Comment on attachment 62568 [details] [diff] [review]
proposed fix

sr=sspitzer

does the PR_LOG() still do the right thing?
Attachment #62568 - Flags: superreview+
fixed PR_LOG as well
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Nice work, thanks for filing/fixing this.

Verified FIXED using Windows 2000, latest trunk build as of 2:30 pm 12-31-2001, 
running Purify.
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: