Closed Bug 391485 Opened 17 years ago Closed 17 years ago

memory leak in nsToolkitProfileService::Flush

Categories

(Toolkit :: Startup and Profile System, defect)

x86
OpenSolaris
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: eagle.lu, Assigned: eagle.lu)

Details

(Keywords: memory-leak)

Attachments

(2 files, 3 obsolete files)

Using memory leak detecting tool libumem.so on opensolaris as following:
1. export LD_PRELOAD=libumem.so
2. export UMEM_DEBUG=default
3. export LD_LIBRARY_PATH=dist/bin (full pathname of thunderbird-bin)
4. mdb ./thunderbird-bin 
5. ::run -P  (in mdb)

libumem.so will detect many memory leaks. one of them is a malloc() called in nsToolkitProfileService::Flush()
Attached file patch (obsolete) —
Attachment #275928 - Attachment is obsolete: true
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → brian.lu
Status: NEW → ASSIGNED
Attachment #275929 - Flags: review?
Component: General → XRE Startup
Product: Thunderbird → Toolkit
QA Contact: general → xre.startup
Attachment #275929 - Flags: review? → review?(benjamin)
Comment on attachment 275929 [details] [diff] [review]
patch

There are other paths out which could leak buffer... can you make buffer an autoclass intead?:

nsAutoArrayPtr<char> buffer = new char[100 + MAXPATHLEN * pCount];
Attachment #275929 - Flags: review?(benjamin) → review-
Attachment #275929 - Attachment is obsolete: true
Attachment #276072 - Flags: review?(benjamin)
Comment on attachment 276072 [details] [diff] [review]
use nsAutoArrayPtr<char> 

Why did you need to put the declaration at the top, instead of when it's first used? Please change that unless there's a good reason.
Attachment #276072 - Flags: review?(benjamin) → review+
Attachment #276729 - Flags: review?(benjamin)
Comment on attachment 276729 [details] [diff] [review]
move the declaration before the first use

Still don't understand why you don't just declare it on the same line you use it, but this is ok.
Attachment #276729 - Flags: review?(benjamin) → review+
Attachment #276729 - Attachment is obsolete: true
Sorry for misunderstanding your point.
Attachment #276933 - Flags: review?(benjamin)
Attachment #276933 - Flags: review?(benjamin) → review+
Attachment #276933 - Flags: approval1.9?
Comment on attachment 276933 [details] [diff] [review]
combine the declaration and assignment in a line

a=bzbarsky
Attachment #276933 - Flags: approval1.9? → approval1.9+
Whiteboard: checkin-needed
Checking in mozilla/toolkit/profile/src/nsToolkitProfileService.cpp;
/cvsroot/mozilla/toolkit/profile/src/nsToolkitProfileService.cpp,v  <--  nsToolkitProfileService.cpp
new revision: 1.17; previous revision: 1.16
done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: checkin-needed
Keywords: mlk
Component: XRE Startup → Startup and Profile System
QA Contact: xre.startup → startup
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: