Bugzilla Bug 351609: test lib->dlh before calling NSUnLinkModule on Mac.
authorwtchang%redhat.com
Tue, 12 Sep 2006 18:26:19 +0000
changeset 3693 6bb17dd81ceeda2bd2fd66806a397a62c9b54a95
parent 3691 691d18545853a07ed2451f2344d4197535cee7c1
child 3695 a62705c8b590c01781a7b0a4fa2cf979068d8fe6
push idunknown
push userunknown
push dateunknown
bugs351609
Bugzilla Bug 351609: test lib->dlh before calling NSUnLinkModule on Mac. r=Mark Mentovai
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));