From 4c6bb127d9b70a31625d3aa58ecea9efea813465 Mon Sep 17 00:00:00 2001
From: Wei Jiangang <wei_jiangang@hoperun.com>
Date: Wed, 29 May 2024 10:53:07 +0800
Subject: [PATCH] release handle when dlerror returns non-nullptr

Signed-off-by: Wei Jiangang <wei_jiangang@hoperun.com>
---
 services/service/src/device_manager_service.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp
index f167f719..b07b8574 100755
--- a/services/service/src/device_manager_service.cpp
+++ b/services/service/src/device_manager_service.cpp
@@ -407,6 +407,7 @@ bool DeviceManagerService::IsDMServiceImplReady()
     dlerror();
     auto func = (CreateDMServiceFuncPtr)dlsym(so_handle, "CreateDMServiceObject");
     if (dlerror() != nullptr || func == nullptr) {
+        dlclose(so_handle);
         LOGE("Create object function is not exist.");
         return false;
     }
-- 
2.39.1

