Closed
Bug 5140
Opened 26 years ago
Closed 26 years ago
Need to use matching memory allocation and deallocation methods
Categories
(Core :: XPCOM, defect, P2)
Tracking
()
RESOLVED
FIXED
M5
People
(Reporter: scottputterman, Assigned: mcmullen)
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
I get a Purify Freeing Mismatched Memory error in nsFileSpec
nsprpath::~nsprpath because modifiedNSPRPath is allocated using PL_strdup but
deallocated using delete[]. There appear to be other places in the file that
does this.
Changing platform from PC to all. Setting as an M5 (plumbing) bug.
Comment 4•26 years ago
|
||
I'll have a patch that should cover all these issues and more in nsFileSpec.h
and nsFileSpec.cpp and the associated platform specific files fairly soon and
will attach it here then.
Comment 5•26 years ago
|
||
Comment 6•26 years ago
|
||
Attached fixes for nsFileSpec code:
memory leak on Mac when moving file (I think, please review).
memory leak in test (figured I might as well).
Used nsCRT and added the include to nsFileSpec.h
Fixes a lot of mismatched memory freeing on Unix, Windows and Mac.
Note: the GetLeafName() code does NOT use new[] as the comments indicate. It
uses strdup(), so you must deallocate with nsCRT::free(). I will follow up with
users of GetLeafName() throughout the tree.
I can checkin these fixes for you if you like, but they should knock out this
bug entirely.
Bruce, you are truly a prince among men! Looking at your diffs now.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
I checked in Bruce's changes, with a couple of trivial changes of my own. Marking
fixed. Bruce, have at it with Purify again...
Comment 9•25 years ago
|
||
Bulk moving to XPCOM, in preparation for removal of XP File Handling component.
(XPFH has received two bugs in ~5 months, and is no longer in active use.)
Component: XP File Handling → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•