Closed Bug 195591 Opened 21 years ago Closed 21 years ago

memory leak in nsWindow::SetTitle

Categories

(Core :: XUL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bryner, Assigned: bryner)

Details

(Keywords: memory-leak)

Attachments

(1 file)

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.
Attached patch patchSplinter Review
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.
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+
checked in.
Status: NEW → RESOLVED
Closed: 21 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: