From c1ccc2e5c50d9a7089ed1cd4c3a29365bdc07527 Mon Sep 17 00:00:00 2001 From: liqinglin <996260657@qq.com> Date: Fri, 25 Oct 2024 16:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=E6=A3=80?= =?UTF-8?q?=E8=A7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liqinglin <996260657@qq.com> --- .../src/dependency/hichain/mine_hichain_connector.cpp | 3 +++ .../src/dependency/softbus/softbus_connector.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/services/implementation/src/dependency/hichain/mine_hichain_connector.cpp b/services/implementation/src/dependency/hichain/mine_hichain_connector.cpp index 44e54a941..c5d37fd50 100644 --- a/services/implementation/src/dependency/hichain/mine_hichain_connector.cpp +++ b/services/implementation/src/dependency/hichain/mine_hichain_connector.cpp @@ -143,6 +143,7 @@ int32_t MineHiChainConnector::DeleteCredentialAndGroup(void) LOGE("failed to delete hichain credential and group with ret:%{public}d.", retValue); return ERR_DM_FAILED; } + g_deviceGroupManager->destroyInfo(&returnInfo); #endif return DM_OK; } @@ -263,9 +264,11 @@ int MineHiChainConnector::ImportCredential(std::string reqJsonStr, std::string & } if (CreateGroup(reqJsonStr) != DM_OK) { DeleteCredentialAndGroup(); + g_deviceGroupManager->destroyInfo(&returnInfo); LOGE("fail to import hichain credential bacause create group unsuccessfully."); return ERR_DM_HICHAIN_GROUP_CREATE_FAILED; } + g_deviceGroupManager->destroyInfo(&returnInfo); #endif LOGI("import device credential info successfully."); return DM_OK; diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp index 8bdbf7e2e..acd632078 100644 --- a/services/implementation/src/dependency/softbus/softbus_connector.cpp +++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp @@ -639,9 +639,11 @@ std::string SoftbusConnector::GetNetworkIdByDeviceId(const std::string &deviceId LOGE("[SOFTBUS]GetNodeKeyInfo failed."); } if (reinterpret_cast(mUdid) == deviceId) { + FreeNodeInfo(nodeInfo); return static_cast(nodeBasicInfo->networkId); } } + FreeNodeInfo(nodeInfo); return ""; } @@ -714,10 +716,12 @@ bool SoftbusConnector::CheckIsOnline(const std::string &targetDeviceId) std::string udid = reinterpret_cast(mUdid); if (udid == targetDeviceId) { LOGI("The device is online."); + FreeNodeInfo(nodeInfo); return true; } } LOGI("The device is not online."); + FreeNodeInfo(nodeInfo); return false; } @@ -734,6 +738,7 @@ DmDeviceInfo SoftbusConnector::GetDeviceInfoByDeviceId(const std::string &device char deviceIdHash[DM_MAX_DEVICE_ID_LEN] = {0}; if (Crypto::GetUdidHash(deviceId, reinterpret_cast(deviceIdHash)) != DM_OK) { LOGE("get deviceIdHash by deviceId: %{public}s failed.", GetAnonyString(deviceId).c_str()); + FreeNodeInfo(nodeInfo); return info; } for (int32_t i = 0; i < deviceCount; ++i) { @@ -742,6 +747,7 @@ DmDeviceInfo SoftbusConnector::GetDeviceInfoByDeviceId(const std::string &device if (GetNodeKeyInfo(DM_PKG_NAME, nodeBasicInfo->networkId, NodeDeviceInfoKey::NODE_KEY_UDID, mUdid, sizeof(mUdid)) != DM_OK) { LOGE("[SOFTBUS]GetNodeKeyInfo failed."); + FreeNodeInfo(nodeInfo); return info; } std::string udid = reinterpret_cast(mUdid); -- Gitee