Closed Bug 1664 Opened 26 years ago Closed 26 years ago

NSGetSharedLibrary leaks the result from PR_GetLibraryPathNSGetSharedLibrary(Str255 inLibName, CFragConnectionID* outID, Ptr* outMainAddr){char*curLibPath;char*freeCurLibPath;OSErrtempErr;Booleanrecursive;FSSpeccurFolder;GetShared

Categories

(NSPR :: NSPR, defect, P2)

PowerPC
Mac System 7.5
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: beard, Assigned: wtc)

Details

PR_GetLibraryPath returns a strduped copy of a string. NSGetSharedLibrary turns around and strdups it again, leaking the value returned from PR_GetLibraryPath. Here's the code fragment that does this (from macdll.c, line 113): freeCurLibPath = curLibPath = strdup(PR_GetLibraryPath()); Here's the line from prlink.c (line 350) that returns a newly duplicated string: copy = strdup(_pr_currentLibPath); Clearly, everytime this gets called a copy of this path string is leaked.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Summary: NSGetSharedLibrary leaks the result from PR_GetLibraryPath NSGetSharedLibrary(Str255 inLibName, CFragConnectionID* outID, Ptr* outMainAddr) { char* curLibPath; char* freeCurLibPath; OSErr tempErr; Boolean recursive; FSSpec curFolder; GetShared → NSGetSharedLibrary leaks the result from PR_GetLibraryPathNSGetSharedLibrary(Str255 inLibName, CFragConnectionID* outID, Ptr* outMainAddr){char*curLibPath;char*freeCurLibPath;OSErrtempErr;Booleanrecursive;FSSpeccurFolder;GetShared
Fixed. The strdup call in NSGetSharedLibrary is unnecessary and should be removed. /cvsroot/mozilla/nsprpub/pr/src/md/mac/macdll.c, revision 3.2.
QA Contact: 3819
will mark verified assuming beard agrees with fix, setting me as QA contact
Status: RESOLVED → VERIFIED
marking verified
Fix looks right. Approved.
NSPR now has its own Bugzilla product. Moving this bug to the NSPR product.
You need to log in before you can comment on or make changes to this bug.