Memory leak of 23 bytes from 1 block allocated in MimeHeaders_get_name

VERIFIED FIXED

Status

MailNews Core
MIME
VERIFIED FIXED
17 years ago
10 years ago

People

(Reporter: stephend@netscape.com (gone - use stephen.donner@gmail.com instead), Assigned: Navin Gupta)

Tracking

({memory-leak})

Trunk
x86
Windows 2000
memory-leak

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

528 bytes, patch
Jean-Francois Ducarroz
: review+
Bienvenu
: superreview+
Details | Diff | Splinter Review
Build: Latest trunk pull @8:45 pm using Windows 2000 / Purify.

Summary: Memory leak of 23 bytes from 1 block allocated in MimeHeaders_get_name

Steps to Reproduce: Reading an inline JPG attachment around 180 lines inside a 
newsgroup, I get:

[W] MLK: Memory leak of 23 bytes from 1 block allocated in PR_Malloc
    Distribution of leaked blocks
    Allocation location
    malloc         [msvcrt.DLL]
    PR_Malloc      [prmem.c:50]
    MimeHeaders_get_name(MimeHeaders *,MimeDisplayOptions *) [mimehdrs.cpp:875]
      s = MimeHeaders_get(hdrs, HEADER_CONTENT_DISPOSITION, PR_FALSE, PR_FALSE);
      if (s)
        {
 =>       name = MimeHeaders_get_parameter(s, HEADER_PARM_FILENAME, &charset, 
NULL);
          PR_Free(s);
        }
    
    MimeInlineImage_parse_begin [mimeiimg.cpp:132]
          nsCAutoString url_with_filename(image_url);
          url_with_filename += "&type=";
          url_with_filename += ct;
 =>       char * filename = MimeHeaders_get_name ( obj->headers, obj->options );
          if (filename)
          {
              char *escapedName = nsEscape(filename, url_Path);
    MimeUntypedText_open_subpart [mimeunty.cpp:369]
        }
    
      /* And start its parser going. */
 =>   status = uty->open_subpart->clazz->parse_begin(uty->open_subpart);
      if (status < 0)
        {
          /* MimeContainer->finalize will take care of shutting it down now. */
    MimeUntypedText_parse_line [mimeunty.cpp:150]
          status = MimeUntypedText_open_subpart (obj,
                                                 MimeUntypedTextSubpartTypeUUE,
                                                 type, ENCODING_UUENCODE,
 =>                                              name, NULL);
          PR_FREEIF(name);
          PR_FREEIF(type);
          if (status < 0) return status;
    convert_and_send_buffer [mimebuf.cpp:168]
        }
    #endif
    
 =>   return (*per_line_fn)(buf, length, closure);
    }
    
    extern "C" int
    mime_LineBuffer [mimebuf.cpp:255]
    
          status = convert_and_send_buffer(*bufferP, *buffer_fpP,
                                               convert_newlines_p,
 =>                                            per_line_fn, closure);
          if (status < 0)
          return status;
    
    MimeObject_parse_buffer [mimeobj.cpp:255]
                             ((int (*PR_CALLBACK) (char *, PRInt32, void *))
                              /* This cast is to turn void into MimeObject */
                              obj->clazz->parse_line),
 =>                          obj);
    }
    
    
    convert_and_send_buffer [mimebuf.cpp:168]
        }
    #endif
    
 =>   return (*per_line_fn)(buf, length, closure);
    }
    
    extern "C" int
    mime_LineBuffer [mimebuf.cpp:255]
    
          status = convert_and_send_buffer(*bufferP, *buffer_fpP,
                                               convert_newlines_p,
 =>                                            per_line_fn, closure);
          if (status < 0)
              return status;
        
    MimeObject_parse_buffer [mimeobj.cpp:255]
                                 ((int (*PR_CALLBACK) (char *, PRInt32, void *))
                                  /* This cast is to turn void into MimeObject 
*/
                                  obj->clazz->parse_line),
     =>                          obj);
        }
        
        
    nsStreamConverter::OnDataAvailable(nsIRequest *,nsISupports 
*,nsIInputStream *,UINT,UINT) [nsStreamConverter.cpp:919]
          else if (mBridgeStream)
          {
            nsMIMESession   *tSession = (nsMIMESession *) mBridgeStream;
     =>     rc = tSession->put_block((nsMIMESession *)mBridgeStream, buf, 
readLen);
          }
        
          PR_FREEIF(buf);
    nsDocumentOpenInfo::OnDataAvailable(nsIRequest *,nsISupports 
*,nsIInputStream *,UINT,UINT) [nsURILoader.cpp:240]
    nsNntpCacheStreamListener::OnDataAvailable(nsIRequest *,nsISupports 
*,nsIInputStream *,UINT,UINT) [nsNNTPProtocol.cpp:747]
    nsStorageTransport::nsReadRequest::OnDataAvailable(nsIRequest *,nsISupports 
*,nsIInputStream *,UINT,UINT) [nsStorageTransport.cpp:625]
    XPTC_InvokeByIndex [xptcinvoke.cpp:152]
    EventHandler   [nsProxyEvent.cpp:514]
    md_EventReceiverProc [plevent.c:1071]
    ScrollDC       [user32.dll]
See my test post at news://news.mcom.com/netscape.public.test 
entitled, "Testing leaks, ignore this".  Man, I sure hope this isnt' a DUP.
(Assignee)

Comment 2

17 years ago
taking, I don't think it is a dupe.
Assignee: ducarroz → naving
QA Contact: esther → stephend
(Assignee)

Comment 4

17 years ago
Created attachment 59588 [details] [diff] [review]
proposed fix

free filename. please review.
Comment on attachment 59588 [details] [diff] [review]
proposed fix

R=ducarroz
Attachment #59588 - Flags: review+
(Assignee)

Comment 6

17 years ago
david, looking for sr.

Comment 7

17 years ago
Comment on attachment 59588 [details] [diff] [review]
proposed fix

sr=bienvenu
Attachment #59588 - Flags: superreview+
(Assignee)

Comment 8

17 years ago
fixed
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
Verified FIXED... latest trunk Win32 build using 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.