Bugzilla Bug 351609: test lib->dlh before calling NSUnLinkModule on Mac. NSPRPUB_PRE_4_2_CLIENT_BRANCH
authorwtchang%redhat.com
Tue, 12 Sep 2006 18:30:06 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 3694 73d88fc3c5c551b6ab0339f0a1c7de137062a5cf
parent 3692 e60b707c5a4dcbdd0f927b8f60be9588c2300ddd
child 3699 00f1eb3e38f7c877fb5b2b10aa693686da225e9f
push idunknown
push userunknown
push dateunknown
bugs351609
Bugzilla Bug 351609: test lib->dlh before calling NSUnLinkModule on Mac. r=Mark Mentovai Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
pr/src/linking/prlink.c
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -1274,17 +1274,18 @@ PR_UnloadLibrary(PRLibrary *lib)
 
 #ifdef XP_UNIX
 #ifdef HAVE_DLL
 #ifdef USE_DLFCN
     result = dlclose(lib->dlh);
 #elif defined(USE_HPSHL)
     result = shl_unload(lib->dlh);
 #elif defined(USE_MACH_DYLD)
-    result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1;
+    if (lib->dlh)
+        result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1;
 #else
 #error Configuration error
 #endif
 #endif /* HAVE_DLL */
 #endif /* XP_UNIX */
 #ifdef XP_PC
     if (lib->dlh) {
         FreeLibrary((HINSTANCE)(lib->dlh));