Closed Bug 478113 Opened 17 years ago Closed 17 years ago

nsMsgDBView::GetCellValue leaks strings

Categories

(MailNews Core :: Backend, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Bienvenu, Assigned: Bienvenu)

Details

(Keywords: memory-leak)

Attachments

(1 file)

Attached patch proposed fixSplinter Review
nsMsgDBView::GetCellValue .Assigns the result of nsMsgDBView::GetString() to nsCStrings - afaict, this is a memory leak because GetString returns an allocated buffer, and we should be using .Adopt. GetCellValue is used by screen readers, I believe.
Attachment #361870 - Flags: superreview?(neil)
Attachment #361870 - Flags: review?(neil)
Comment on attachment 361870 [details] [diff] [review] proposed fix >+ aValue.Adopt(GetString (isContainerOpen ? >+ NS_LITERAL_STRING("messageExpanded").get() >+ : NS_LITERAL_STRING("messageCollapsed").get())); Nit: personally I prefer the : at the end of the previous line. >+ aValue.Adopt(GetString ((flags & nsMsgMessageFlags::Read) ? >+ EmptyString().get() : NS_LITERAL_STRING("messageUnread").get())); I wonder why we bother calling GetString on an empty string. I was thinking along the lines of if (flags & nsMsgMessageFlags::Read) aValue.Truncate(); else aValue.Adopt(GetString(NS_LITERAL_STRING("messageUnread").get()));
Attachment #361870 - Flags: superreview?(neil)
Attachment #361870 - Flags: superreview+
Attachment #361870 - Flags: review?(neil)
Attachment #361870 - Flags: review+
I've made this match GetCellText, i.e., truncate aValue before the switch, and then just do .Adopts if the flag condition is right. Fix checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: