Bugzilla bug #45432: fixed memory leak in pr_Mac_LoadNamedFragment and NSPRPUB_CLIENT_BRANCH
authorwtc%netscape.com
Fri, 29 Dec 2000 21:40:49 +0000
branchNSPRPUB_CLIENT_BRANCH
changeset 1649 55962ecd41e5f7e6367059a90192bf8b928b6856
parent 1648 23acc3c668c42adcf2a84f07ed56e9d886e32557
child 1650 da0a7fecffd4027f4dcccdba5de7c8d58d5b9111
push idunknown
push userunknown
push dateunknown
bugs45432
Bugzilla bug #45432: fixed memory leak in pr_Mac_LoadNamedFragment and pr_Mac_LoadIndexedFragment. (NSPRPUB_CLIENT_BRANCH)
pr/src/linking/prlink.c
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -936,16 +936,18 @@ pr_Mac_LoadNamedFragment(const FSSpec *f
   newLib->next = pr_loadmap;
   pr_loadmap = newLib;
 
   result = newLib;    /* success */
   PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", newLib->name));
 
 unlock:
 	if (result == NULL) {
+		if (newLib != NULL)
+			PR_DELETE(newLib);
 		PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO());
 		DLLErrorInternal(_MD_ERRNO());  /* sets error text */
 	}
 	PR_ExitMonitor(pr_linker_lock);
 	return result;
 }
 
 
@@ -998,16 +1000,18 @@ pr_Mac_LoadIndexedFragment(const FSSpec 
   newLib->next = pr_loadmap;
   pr_loadmap = newLib;
 
   result = newLib;    /* success */
   PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", newLib->name));
 
 unlock:
 	if (result == NULL) {
+		if (newLib != NULL)
+			PR_DELETE(newLib);
 		PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO());
 		DLLErrorInternal(_MD_ERRNO());  /* sets error text */
 	}
 	PR_ExitMonitor(pr_linker_lock);
 	return result;
 }