Closed Bug 251267 Opened 21 years ago Closed 21 years ago

Memory leak in XRemoteService.cpp

Categories

(Core Graveyard :: X-remote, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pkwarren, Assigned: pkwarren)

Details

(Keywords: memory-leak)

Attachments

(1 file)

I'm seeing a memory leak in XRemoteService.cpp running under Valgrind. XRemoteService::GetProfileName calls nsProfile::GetCurrentProfile, which returns a profile string allocated with ToNewUnicode(). This string is never free'd in the XRemoteService code.
Attached patch Patch v1Splinter Review
I have verified this fixes the leak by running Mozilla before/after in Valgrind.
Here is the stack from Valgrind: 16 bytes in 1 blocks are definitely lost in loss record 40 of 341 at 0x1B9046D0: malloc (vg_replace_malloc.c:109) by 0x1B9E08AF: PR_Malloc (prmem.c:436) by 0x1BE76B3B: nsMemoryImpl::Alloc(unsigned) (nsMemoryImpl.cpp:325) by 0x8080D62: nsMemory::Alloc(unsigned) (nsMemory.cpp:87) by 0x80751E5: unsigned short* AllocateStringCopy<nsAString, unsigned short>(nsAString const&, unsigned short*) (nsReadableUtils.cpp:310) by 0x8073509: ToNewUnicode(nsAString const&) (nsReadableUtils.cpp:369) by 0x1D11BC39: nsProfileAccess::GetCurrentProfile(unsigned short**) (nsProfileAccess.cpp:609) by 0x1D10BFDF: nsProfile::GetCurrentProfile(unsigned short**) (nsProfile.cpp:1145) by 0x1DDA4FAB: XRemoteService::GetProfileName(nsACString&) (XRemoteService.cpp:1071) by 0x1DDA2966: XRemoteService::CreateProxyWindow() (XRemoteService.cpp:522)
Keywords: mlk
Attachment #153083 - Flags: superreview?(blizzard)
Attachment #153083 - Flags: review?(blizzard)
Attachment #153083 - Flags: superreview?(blizzard)
Attachment #153083 - Flags: superreview+
Attachment #153083 - Flags: review?(blizzard)
Attachment #153083 - Flags: review+
Flags: blocking1.8a2?
Assignee: blizzard → pkwarren
Flags: blocking1.8a2?
Status: NEW → ASSIGNED
Fixed. Checking in XRemoteService.cpp; /cvsroot/mozilla/xpfe/components/xremote/src/XRemoteService.cpp,v <-- XRemoteService.cpp new revision: 1.42; previous revision: 1.41 done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: