diff --git a/services/dtbschedmgr/src/common_event_listener.cpp b/services/dtbschedmgr/src/common_event_listener.cpp index a0d76983..e94d9717 100644 --- a/services/dtbschedmgr/src/common_event_listener.cpp +++ b/services/dtbschedmgr/src/common_event_listener.cpp @@ -93,13 +93,11 @@ void CommonEventListener::OnReceiveEvent(const EventFwk::CommonEventData &eventD ErrCode CommonEventListener::GetForegroundOsAccountLocalId(int32_t& accountId) { - int32_t newId; - ErrCode err = AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(newId); + ErrCode err = AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(accountId); if (err != ERR_OK) { HILOGE("GetForegroundOsAccountLocalId passing param invalid or return error!, err : %{public}d", err); return INVALID_PARAMETERS_ERR; } - accountId = newId; HILOGD("GetForegroundOsAccountLocalId accountId is: %{public}d", accountId); GetOsAccountType(accountId); return ERR_OK; diff --git a/services/dtbschedmgr/src/datashare_manager.cpp b/services/dtbschedmgr/src/datashare_manager.cpp index e48d3206..e0d65d53 100644 --- a/services/dtbschedmgr/src/datashare_manager.cpp +++ b/services/dtbschedmgr/src/datashare_manager.cpp @@ -137,7 +137,7 @@ Uri DataShareManager::AssembleUserSecureUri(int userId, const std::string &key) int32_t DataShareManager::GetLocalAccountId() { - int32_t id; + int32_t id = -1; ErrCode err = AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(id); if (err != ERR_OK) { HILOGE("GetLocalAccountId passing param invalid or return error!, err : %{public}d", err);