Bugzilla bug #77109: fixed NSPR library memory leaks on Mac. Patch is

contributed by Patrick Beard <beard@netscape.com>. r=sfraser,wtc.
This commit is contained in:
wtc%netscape.com 2001-05-22 23:34:54 +00:00
parent e46d5f7fc4
commit d000404490

View File

@ -619,6 +619,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
if (err != noErr) if (err != noErr)
{ {
oserr = err; oserr = err;
PR_DELETE(lm);
goto unlock; goto unlock;
} }
@ -652,6 +653,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
if (cMacPath == NULL) if (cMacPath == NULL)
{ {
oserr = _MD_ERRNO(); oserr = _MD_ERRNO();
PR_DELETE(lm);
goto unlock; goto unlock;
} }
@ -677,6 +679,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
{ {
oserr = _MD_ERRNO(); oserr = _MD_ERRNO();
PR_DELETE(cMacPath); PR_DELETE(cMacPath);
PR_DELETE(lm);
goto unlock; goto unlock;
} }
cMacPath[index] = 0; cMacPath[index] = 0;
@ -698,6 +701,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
if (err != noErr) if (err != noErr)
{ {
oserr = err; oserr = err;
PR_DELETE(lm);
goto unlock; goto unlock;
} }
fileSpec.parID = pb.dirInfo.ioDrDirID; fileSpec.parID = pb.dirInfo.ioDrDirID;
@ -708,6 +712,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
if (err != noErr) if (err != noErr)
{ {
oserr = err; oserr = err;
PR_DELETE(lm);
goto unlock; goto unlock;
} }
@ -719,6 +724,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
if (err != noErr) if (err != noErr)
{ {
oserr = err; oserr = err;
PR_DELETE(lm);
goto unlock; goto unlock;
} }
} }
@ -1016,8 +1022,10 @@ pr_Mac_LoadIndexedFragment(const FSSpec *fileSpec, PRUint32 fragIndex)
/* Finally, try to load the library */ /* Finally, try to load the library */
err = NSLoadIndexedFragment(&resolvedSpec, fragIndex, &fragmentName, &connectionID); err = NSLoadIndexedFragment(&resolvedSpec, fragIndex, &fragmentName, &connectionID);
if (err != noErr) if (err != noErr) {
PR_DELETE(newLib);
goto unlock; goto unlock;
}
newLib->name = fragmentName; /* was malloced in NSLoadIndexedFragment */ newLib->name = fragmentName; /* was malloced in NSLoadIndexedFragment */
newLib->dlh = connectionID; newLib->dlh = connectionID;