Closed
Bug 110700
Opened 24 years ago
Closed 24 years ago
MLK: Memory leak of 1 byte from 1 block allocated in PL_strdup
Categories
(MailNews Core :: MIME, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: naving, Assigned: bugzilla)
Details
(Keywords: memory-leak, Whiteboard: have fix)
Attachments
(1 file, 2 obsolete files)
|
799 bytes,
patch
|
sspitzer
:
superreview+
|
Details | Diff | Splinter Review |
Distribution of leaked blocks
Allocation location
malloc [msvcrt.DLL]
PL_strdup [strdup.c:46]
nsPrefService::GetCharPref(char const*,char * *)
[nsPrefService.h:57]
MimeInlineTextPlain_parse_begin [mimetpla.cpp:165]
MimeMessage_close_headers [mimemsg.cpp:457]
MimeMessage_parse_line [mimemsg.cpp:271]
convert_and_send_buffer [mimebuf.cpp:168]
mime_LineBuffer [mimebuf.cpp:255]
MimeObject_parse_buffer [mimeobj.cpp:255]
nsStreamConverter::OnDataAvailable(nsIRequest *,nsISupports
*,nsIInputStream *,UINT,UINT) [nsStreamConverter.cpp:919]
nsDocumentOpenInfo::OnDataAvailable(nsIRequest *,nsISupports
*,nsIInputStream *,UINT,UINT) [nsURILoader.cpp:240]
nsMailboxProtocol::ReadMessageResponse(nsIInputStream *,UINT,UINT)
[nsMailboxProtocol.cpp:570]
nsMailboxProtocol::ProcessProtocolState(nsIURI *,nsIInputStream
*,UINT,UINT) [nsMailboxProtocol.cpp:661]
nsMsgProtocol::OnDataAvailable(nsIRequest *,nsISupports
*,nsIInputStream *,UINT,UINT) [nsMsgProtocol.cpp:262]
nsOnDataAvailableEvent::HandleEvent(void)
[nsStreamListenerProxy.cpp:193]
PL_HandleEvent [plevent.c:590]
md_EventReceiverProc [plevent.c:1071]
ScrollDC [user32.dll]
ScrollDC [user32.dll]
DispatchMessageA [user32.dll]
| Assignee | ||
Comment 1•24 years ago
|
||
we are leaking mCitationColor. Apparently an empty string in that case but could
be more.
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•24 years ago
|
||
We need to do the same than in
MimeInlineTextPlainFlowed::MimeInlineTextPlainFlowed_parse_eof. Patch coming...
| Assignee | ||
Comment 3•24 years ago
|
||
I cannot generate a diff right now because of a cvs lock :-(
Whiteboard: have fix
| Assignee | ||
Comment 4•24 years ago
|
||
| Reporter | ||
Comment 5•24 years ago
|
||
Comment on attachment 60394 [details] [diff] [review]
Proposed fix, v1
looks ok to me.
Attachment #60394 -
Flags: review+
Comment on attachment 60394 [details] [diff] [review]
Proposed fix, v1
r=varada.
We should file a bug and get rid of these gotos in mime though :)
Comment 7•24 years ago
|
||
instead of doing it this way, could we make mCitation color an nsXPIDLCString or
a nsCString, so that when the text object gets destroyed, we'll clean up after
ourselves automatically?
| Assignee | ||
Comment 8•24 years ago
|
||
yes I can but that would be a revolution in Mine to use anything else than a
char* :-)
Comment 9•24 years ago
|
||
revolutions need to start somewhere =).
| Assignee | ||
Updated•24 years ago
|
Attachment #60394 -
Attachment is obsolete: true
| Assignee | ||
Comment 10•24 years ago
|
||
I've replaced "char *mCitationColor" by "nsXPIDLCString mCitationColor"
Comment 11•24 years ago
|
||
Comment on attachment 61124 [details] [diff] [review]
Proposed fix, v2
Viva la Revolucion!
one question, where we used to free the mCitation color, should we be setting
it to null?
| Assignee | ||
Comment 12•24 years ago
|
||
no. mCitationColor is used only in this file and we set it to an empty string
every time we start using it. Therefore setting it to null when done with is
wasn't needed.
Comment 13•24 years ago
|
||
Comment on attachment 61124 [details] [diff] [review]
Proposed fix, v2
thanks for the explanation. r=sspitzer
Attachment #61124 -
Flags: review+
| Assignee | ||
Comment 14•24 years ago
|
||
Comment on attachment 61124 [details] [diff] [review]
Proposed fix, v2
This patch does not work!
Attachment #61124 -
Attachment is obsolete: true
| Assignee | ||
Updated•24 years ago
|
Attachment #60394 -
Attachment is obsolete: false
| Assignee | ||
Comment 15•24 years ago
|
||
The second patch does not work because mine create new mime class using MALLOC
and not new. Therefore you cannot use an XPIDLString, that will cause a crash!
Seth, can you SR the first patch. Thanks.
Comment 16•24 years ago
|
||
is there any string trickery would could here, to avoid the goto?
like adopting the text->mCitationColor after this line:
if (obj->closed_p) return 0;
nsCAutoString citationColor;
citationColor.Adopt(text->mCitationColor);
and then when the method returns, and the adopted parent of text-
>mCitationColor goes out of scope (as it would be a stack based object), it
would free the buffer?
cc jag / dbaron, they've got string string kung foo.
| Assignee | ||
Updated•24 years ago
|
Attachment #60394 -
Attachment is obsolete: true
| Assignee | ||
Comment 17•24 years ago
|
||
Comment 18•24 years ago
|
||
Comment on attachment 61167 [details] [diff] [review]
Proposed fix, v3
sr=sspitzer
looks good. this is a trick we could use to fix some other confusing goto in
mailnews.
Attachment #61167 -
Flags: superreview+
| Assignee | ||
Comment 19•24 years ago
|
||
Fixed and checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Verified FIXED, using my vcard test message with inline text, running on
Windows 2000 under Purify with the latest trunk build as of 11:35 pm December
10th.
Status: RESOLVED → VERIFIED
Comment 21•24 years ago
|
||
Yep, this is what I would have suggested.
Updated•21 years ago
|
Product: MailNews → Core
Updated•17 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•