Fix nullpointer dereference in libnativeloader

The `char* path` argument of OpenNativeLibrary() can be nullptr. We are
constructing std::string from the path, which is a bug. Fixing it by
using char* without converting it to std::string.

Test: run-gtests.sh
JniCompilerTest.CompileAndRunIntMethodThroughStubNormalCompiler
is successful.

Change-Id: I91249da7c1a72a2dff9bc77e477b465e0c7ee056
diff --git a/libnativeloader/native_loader_namespace.cpp b/libnativeloader/native_loader_namespace.cpp
index 90f730c..58ac686 100644
--- a/libnativeloader/native_loader_namespace.cpp
+++ b/libnativeloader/native_loader_namespace.cpp
@@ -115,15 +115,14 @@
   }
 }
 
-void* NativeLoaderNamespace::Load(const std::string& lib_name) const {
+void* NativeLoaderNamespace::Load(const char* lib_name) const {
   if (!IsBridged()) {
     android_dlextinfo extinfo;
     extinfo.flags = ANDROID_DLEXT_USE_NAMESPACE;
     extinfo.library_namespace = this->ToRawAndroidNamespace();
-    return android_dlopen_ext(lib_name.c_str(), RTLD_NOW, &extinfo);
+    return android_dlopen_ext(lib_name, RTLD_NOW, &extinfo);
   } else {
-    return NativeBridgeLoadLibraryExt(lib_name.c_str(), RTLD_NOW,
-                                      this->ToRawNativeBridgeNamespace());
+    return NativeBridgeLoadLibraryExt(lib_name, RTLD_NOW, this->ToRawNativeBridgeNamespace());
   }
 }
 
diff --git a/libnativeloader/native_loader_namespace.h b/libnativeloader/native_loader_namespace.h
index 1575f8c..71e4247 100644
--- a/libnativeloader/native_loader_namespace.h
+++ b/libnativeloader/native_loader_namespace.h
@@ -52,7 +52,7 @@
   }
 
   bool Link(const NativeLoaderNamespace& target, const std::string& shared_libs) const;
-  void* Load(const std::string& lib_name) const;
+  void* Load(const char* lib_name) const;
   char* GetError() const;
 
   static NativeLoaderNamespace GetExportedNamespace(const std::string& name, bool is_bridged);