snprintf(filepath, 512, "%s/%s", default_engine_path, MA_DEFAULT_WAKEUP_MANAGER_FILENAME);
char *error;
- mPluginHandle = NULL;
+ mPluginHandle = nullptr;
mPluginHandle = dlopen(filepath, RTLD_LAZY);
- if (NULL != (error = dlerror())) {
+ if (nullptr != (error = dlerror())) {
+ MAS_LOGE("[ERROR] Fail to dlopen(%s), error(%s)", filepath, error);
+ if (mPluginHandle) dlclose(mPluginHandle);
+ mPluginHandle = nullptr;
+ return -1; //MAS_ERROR_OPERATION_FAILED;
+ }
+ if (nullptr == mPluginHandle) {
MAS_LOGE("[ERROR] Fail to dlopen(%s), error(%s)", filepath, error);
return -1; //MAS_ERROR_OPERATION_FAILED;
}