diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index 772980d2698cfc55052dc26f56c13f9372b78761..00fde148e8881307c76abd5d1e5125777e9f28e8 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -628,7 +628,10 @@ void DmAuthManager::OnSessionOpened(int32_t sessionId, int32_t sessionSide, int3 void DmAuthManager::OnSessionClosed(const int32_t sessionId) { LOGI("DmAuthManager::OnSessionClosed sessionId = %{public}d", sessionId); - AuthenticateFinish(); + if (authResponseState_ != nullptr) { + isFinishOfLocal_ = false; + AuthenticateFinish(); + } } void DmAuthManager::ProcessSourceMsg() @@ -1430,7 +1433,9 @@ void DmAuthManager::SinkAuthenticateFinish() processInfo_.pkgName = authResponseContext_->peerBundleName; listener_->OnSinkBindResult(processInfo_, peerTargetId_, authResponseContext_->reply, authResponseContext_->state, GenerateBindResultContent()); - if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_FINISH && + if ((authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_FINISH || + authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_CONFIRM || + authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_SHOW) && (authResponseContext_->authType == AUTH_TYPE_NFC || authPtr_ != nullptr)) { authUiStateMgr_->UpdateUiState(DmUiStateMsg::MSG_CANCEL_PIN_CODE_SHOW); authUiStateMgr_->UpdateUiState(DmUiStateMsg::MSG_CANCEL_CONFIRM_SHOW); diff --git a/services/service/src/device_manager_service_listener.cpp b/services/service/src/device_manager_service_listener.cpp index 93a1e48204ce486a3da2955c3896e1b8841797b1..e4004c096eb46618501dd7819abac12fe7e82c48 100644 --- a/services/service/src/device_manager_service_listener.cpp +++ b/services/service/src/device_manager_service_listener.cpp @@ -74,11 +74,13 @@ void handleExtraData(const DmDeviceInfo &info, DmDeviceBasicInfo &deviceBasicInf cJSON_Delete(extraDataJsonObj); cJSON *basicExtraDataJsonObj = cJSON_CreateObject(); if (basicExtraDataJsonObj == NULL) { + cJSON_free(customData); return; } cJSON_AddStringToObject(basicExtraDataJsonObj, PARAM_KEY_CUSTOM_DATA, customData); char *basicExtraData = cJSON_PrintUnformatted(basicExtraDataJsonObj); if (basicExtraData == nullptr) { + cJSON_free(customData); cJSON_Delete(basicExtraDataJsonObj); return; } diff --git a/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp b/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp index 313ff8721514d64fb304ef7d6609b746eb7a9fa0..e275bbd95741a522f6d54c9307fd5ac1165c4f66 100644 --- a/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp +++ b/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp @@ -88,6 +88,7 @@ int32_t DMCommTool::SendUserIds(const std::string rmtNetworkId, return ERR_DM_FAILED; } std::string msgStr(msg); + SON_free(msg); cJSON_Delete(root); CommMsg commMsg(DM_COMM_SEND_LOCAL_USERIDS, msgStr); std::string payload = GetCommMsgString(commMsg); @@ -117,6 +118,7 @@ void DMCommTool::RspLocalFrontOrBackUserIds(const std::string rmtNetworkId, return; } std::string msgStr(msg); + cJSON_free(msg); cJSON_Delete(root); CommMsg commMsg(DM_COMM_RSP_LOCAL_USERIDS, msgStr); std::string payload = GetCommMsgString(commMsg);