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.
Upgraded priority to P2.
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.
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
Last Resolved: 19 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...
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.