Closed Bug 110661 Opened 24 years ago Closed 24 years ago

Leaking imap progress string

Categories

(MailNews Core :: Networking: IMAP, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Bienvenu, Assigned: Bienvenu)

Details

(Keywords: memory-leak)

Attachments

(1 file, 2 obsolete files)

[W] MLK: Memory leak of 48 bytes from 1 block allocated in PR_Malloc Distribution of leaked blocks Allocation location malloc [dbgheap.c:129] PR_Malloc [prmem.c:54] nsMemoryImpl::Alloc(UINT) [nsMemoryImpl.cpp:320] nsMemory::Alloc(UINT) [nsMemoryImpl.cpp:556] AllocateStringCopy(nsAString const&,WORD *) [nsReadableUtils.cpp:191] ToNewUnicode(nsAString const&) [nsReadableUtils.cpp:251] nsStringBundle::GetStringFromID(int,WORD * *) [nsStringBundle.cpp:378] nsImapIncomingServer::GetImapStringByID(int,WORD * *) [nsImapIncomingServer.cpp:2058] if (m_stringBundle) { PRUnichar *ptrv = nsnull; => res = m_stringBundle->GetStringFromID(aMsgId, &ptrv); if (NS_FAILED(res)) { nsImapMailFolder::ProgressStatus(nsIImapProtocol *,UINT,WORD const*) [nsImapMailFolder.cpp:4516] { nsCOMPtr<nsIImapServerSink> serverSink = do_QueryInterface(server); if (serverSink) => serverSink->GetImapStringByID(aMsgId, &progressMsg); } if (!progressMsg) IMAPGetStringByID(aMsgId, &progressMsg); ProgressStatusProxyEvent::HandleEvent(void) [nsImapProxyEvent.cpp:1045]
fix coming up.
Status: NEW → ASSIGNED
Keywords: mlk
QA Contact: huang → stephend
this leak happens when we have a formatted string to display status, e.g., when you delete a message and it displays the "moving to folder %S" message
Keywords: nsbeta1+
need to free progress string before assigning it.
Comment on attachment 58280 [details] [diff] [review] proposed fix (and fix for annoying auto compact assertion on biff) You could make progressMsg a nsXPIDLString. Either way, r=hwaara
Attachment #58280 - Flags: review+
nsXPIDLString will be more safe if someone add something here in future. All those TextFormatter constructs can be cleaned up to use FormatStringFrom.., probably we should have another bug for that.
You'd have to rewrite the code to use an nsXPIDLString, or I would have done it.
Attached patch patch using nsXPIDLString (obsolete) — Splinter Review
reviews, please. Again, like the other patch, I'm using the Length() == 0 check instead of a null check because the null check will never be false for a local variable.
Two things: 1. Maybe you should use .IsEmpty() instead of checking Length() for a 0 value? 2. Is there a reason for using .Adopt() instead of .Assign() (or just '=' the value directly)?
using '=' wont' compile, using .Assign doesn't run (probably because there's already data in the string), and .Adopt both works, and has the advantage of avoiding an extra copy and free.
Comment on attachment 58358 [details] [diff] [review] new patch with IsEmpty r=hwaara
Attachment #58358 - Flags: review+
Attachment #58280 - Attachment is obsolete: true
Comment on attachment 58358 [details] [diff] [review] new patch with IsEmpty sr=sspitzer
Attachment #58358 - Flags: superreview+
Attachment #58356 - Attachment is obsolete: true
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Verified FIXED. m_stringBundle didn't show up in any of my expanded Purify logs on Windows 2000 with the latest trunk build (IMAP).
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

Created:
Updated:
Size: