Fix closing unopened shared libraries.

BUG=18208440

Change-Id: I619317803fcc13fffc8a2df427c8d504a86cdcba
Reviewed-on: https://swiftshader-review.googlesource.com/1460
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Common/SharedLibrary.hpp b/src/Common/SharedLibrary.hpp
index 8c9b77e..790bd29a 100644
--- a/src/Common/SharedLibrary.hpp
+++ b/src/Common/SharedLibrary.hpp
@@ -84,10 +84,13 @@
 		return 0;

 	}

 

-	inline void freeLibrary(void *library)

-	{

-		dlclose(library);

-	}

+    inline void freeLibrary(void *library)

+    {

+        if(library)

+        {

+            dlclose(library);

+        }

+    }

 

 	inline void *getProcAddress(void *library, const char *name)

 	{