diff options
author | wtc%netscape.com <devnull@localhost> | 2001-05-22 23:31:57 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2001-05-22 23:31:57 +0000 |
commit | 1e83416fb85bd5c716ddea6f763eb7e7940b5c42 (patch) | |
tree | 8f0664f18b9e96a91c6643d577b281a2c83d0493 | |
parent | 0662ddef5046d868a60787b179ed5eaa63523320 (diff) | |
download | nspr-hg-1e83416fb85bd5c716ddea6f763eb7e7940b5c42.tar.gz |
Bugzilla bug #77109: fixed NSPR library memory leaks on Mac. Patch is
contributed by Patrick Beard <beard@netscape.com>. r=sfraser,wtc.
NSPRPUB_CLIENT_BRANCH
-rw-r--r-- | pr/src/linking/prlink.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index f10f6f94..0e36e1da 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -603,6 +603,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) if (err != noErr) { oserr = err; + PR_DELETE(lm); goto unlock; } @@ -636,6 +637,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) if (cMacPath == NULL) { oserr = _MD_ERRNO(); + PR_DELETE(lm); goto unlock; } @@ -661,6 +663,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) { oserr = _MD_ERRNO(); PR_DELETE(cMacPath); + PR_DELETE(lm); goto unlock; } cMacPath[index] = 0; @@ -682,6 +685,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) if (err != noErr) { oserr = err; + PR_DELETE(lm); goto unlock; } fileSpec.parID = pb.dirInfo.ioDrDirID; @@ -692,6 +696,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) if (err != noErr) { oserr = err; + PR_DELETE(lm); goto unlock; } @@ -703,6 +708,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) if (err != noErr) { oserr = err; + PR_DELETE(lm); goto unlock; } } @@ -992,8 +998,10 @@ pr_Mac_LoadIndexedFragment(const FSSpec *fileSpec, PRUint32 fragIndex) /* Finally, try to load the library */ err = NSLoadIndexedFragment(&resolvedSpec, fragIndex, &fragmentName, &connectionID); - if (err != noErr) + if (err != noErr) { + PR_DELETE(newLib); goto unlock; + } newLib->name = fragmentName; /* was malloced in NSLoadIndexedFragment */ newLib->dlh = connectionID; |