memory leak in nsWindow::SetTitle

RESOLVED FIXED

Status

()

Core
XUL
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: Brian Ryner (not reading), Assigned: Brian Ryner (not reading))

Tracking

({memory-leak})

Trunk
x86
Linux
memory-leak
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

15 years ago
Valgrind output:

==4741== 8 bytes in 2 blocks are definitely lost in loss record 9 of 121
==4741==    at 0x4015DD24: malloc (vg_clientfuncs.c:100)
==4741==    by 0x40288884: PR_Malloc
(../../../../../nsprpub/pr/src/malloc/prmem.c:433)
==4741==    by 0x41950DB4: nsMemoryImpl::Alloc(unsigned)
(../../../xpcom/base/nsMemoryImpl.cpp:319)
==4741==    by 0x806BBE3: nsMemory::Alloc(unsigned) (nsMemory.cpp:87)
==4741==    by 0x44078E5A: nsWindow::SetTitle(nsString const&)
(../../../../widget/src/gtk/nsWindow.cpp:2381)

The problem is that we allocate platformText if the length returned by
GetMaxLength() is > 0, but we only free it if the length returned by Convert()
is also > 0.  This is not always the case.
(Assignee)

Comment 1

15 years ago
Created attachment 116013 [details] [diff] [review]
patch

Fix the leak, plus quiet a compiler warning about platformText potentially
being used uninitialized.

I don't think any of the other platform widget code is affected by this.
(Assignee)

Updated

15 years ago
Attachment #116013 - Flags: review?(blizzard)
Comment on attachment 116013 [details] [diff] [review]
patch

r+sr=blizzard

Go ahead and check it in.
Attachment #116013 - Flags: superreview+
Attachment #116013 - Flags: review?(blizzard)
Attachment #116013 - Flags: review+
(Assignee)

Comment 3

15 years ago
checked in.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.