已开启
框架空指针解引用 #2259
I_am__ok创建于 6 天前
框架空指针解引用 #2259
已开启
共 3 个文件变更+6-6
| @@ -918,7 +918,7 @@ void Service::HandleCurBundleEndWork(std::string bundleName, const BackupRestore | |||
| 918 | return; | 918 | return; |
| 919 | } | 919 | } |
| 920 | std::lock_guard<std::mutex> lock(mutexPtr->callbackMutex); | 920 | std::lock_guard<std::mutex> lock(mutexPtr->callbackMutex); |
| 921 | - auto backUpConnection = session_->GetExtConnection(bundleName); | 921 | + auto backUpConnection = session_->GetExtConnection(bundleName).promote(); |
| 922 | if (backUpConnection == nullptr) { | 922 | if (backUpConnection == nullptr) { |
| 923 | HILOGE("backUpConnection is empty, bundle:%{public}s", bundleName.c_str()); | 923 | HILOGE("backUpConnection is empty, bundle:%{public}s", bundleName.c_str()); |
| 924 | return; | 924 | return; |
| @@ -1434,7 +1434,7 @@ ErrCode Service::ClearResidualBundleData(const std::string &bundleName) | |||
| 1434 | if (session_ == nullptr) { | 1434 | if (session_ == nullptr) { |
| 1435 | return BError(BError::Codes::SA_INVAL_ARG); | 1435 | return BError(BError::Codes::SA_INVAL_ARG); |
| 1436 | } | 1436 | } |
| 1437 | - auto backUpConnection = session_->GetExtConnection(bundleName); | 1437 | + auto backUpConnection = session_->GetExtConnection(bundleName).promote(); |
| 1438 | if (backUpConnection == nullptr) { | 1438 | if (backUpConnection == nullptr) { |
| 1439 | HILOGE("BackUpConnection is empty, bundle:%{public}s", bundleName.c_str()); | 1439 | HILOGE("BackUpConnection is empty, bundle:%{public}s", bundleName.c_str()); |
| 1440 | return BError(BError::Codes::SA_INVAL_ARG); | 1440 | return BError(BError::Codes::SA_INVAL_ARG); |
| @@ -229,7 +229,7 @@ void Service::StartGetFdTask(std::string bundleName, wptr<Service> ptr) | |||
| 229 | if (session == nullptr) { | 229 | if (session == nullptr) { |
| 230 | throw BError(BError::Codes::SA_INVAL_ARG, "session is nullptr"); | 230 | throw BError(BError::Codes::SA_INVAL_ARG, "session is nullptr"); |
| 231 | } | 231 | } |
| 232 | - auto backUpConnection = session->GetExtConnection(bundleName); | 232 | + auto backUpConnection = session->GetExtConnection(bundleName).promote(); |
| 233 | if (backUpConnection == nullptr) { | 233 | if (backUpConnection == nullptr) { |
| 234 | throw BError(BError::Codes::SA_INVAL_ARG, "backUpConnection is empty"); | 234 | throw BError(BError::Codes::SA_INVAL_ARG, "backUpConnection is empty"); |
| 235 | } | 235 | } |
| @@ -982,7 +982,7 @@ ErrCode Service::VerifySendRateParam() | |||
| 982 | 982 | ||
| 983 | ErrCode Service::HandleCurBundleFileReady(const std::string &bundleName, const std::string &fileName, bool isIncBackup) | 983 | ErrCode Service::HandleCurBundleFileReady(const std::string &bundleName, const std::string &fileName, bool isIncBackup) |
| 984 | { | 984 | { |
| 985 | - auto backUpConnection = session_->GetExtConnection(bundleName); | 985 | + auto backUpConnection = session_->GetExtConnection(bundleName).promote(); |
| 986 | if (backUpConnection == nullptr) { | 986 | if (backUpConnection == nullptr) { |
| 987 | HILOGE("AppFileReady error, backUpConnection is empty, bundleName:%{public}s", bundleName.c_str()); | 987 | HILOGE("AppFileReady error, backUpConnection is empty, bundleName:%{public}s", bundleName.c_str()); |
| 988 | return BError(BError::Codes::SA_INVAL_ARG); | 988 | return BError(BError::Codes::SA_INVAL_ARG); |
| @@ -1014,7 +1014,7 @@ ErrCode Service::HandleCurBundleFileReady(const std::string &bundleName, const s | |||
| 1014 | 1014 | ||
| 1015 | ErrCode Service::HandleCurAppDone(ErrCode errCode, const std::string &bundleName, bool isIncBackup) | 1015 | ErrCode Service::HandleCurAppDone(ErrCode errCode, const std::string &bundleName, bool isIncBackup) |
| 1016 | { | 1016 | { |
| 1017 | - auto backUpConnection = session_->GetExtConnection(bundleName); | 1017 | + auto backUpConnection = session_->GetExtConnection(bundleName).promote(); |
| 1018 | if (backUpConnection == nullptr) { | 1018 | if (backUpConnection == nullptr) { |
| 1019 | HILOGE("App finish error, backUpConnection is empty, bundleName:%{public}s", bundleName.c_str()); | 1019 | HILOGE("App finish error, backUpConnection is empty, bundleName:%{public}s", bundleName.c_str()); |
| 1020 | return BError(BError::Codes::SA_INVAL_ARG); | 1020 | return BError(BError::Codes::SA_INVAL_ARG); |
| @@ -1622,7 +1622,7 @@ void Service::HandleOnReleaseAndDisconnect(sptr<SvcSessionManager> sessionPtr, c | |||
| 1622 | HILOGE("SessionPtr is nullptr."); | 1622 | HILOGE("SessionPtr is nullptr."); |
| 1623 | return; | 1623 | return; |
| 1624 | } | 1624 | } |
| 1625 | - auto sessionConnection = sessionPtr->GetExtConnection(bundleName); | 1625 | + auto sessionConnection = sessionPtr->GetExtConnection(bundleName).promote(); |
| 1626 | if (sessionConnection == nullptr) { | 1626 | if (sessionConnection == nullptr) { |
| 1627 | HILOGE("Error, sessionConnection is empty, bundleName:%{public}s", bundleName.c_str()); | 1627 | HILOGE("Error, sessionConnection is empty, bundleName:%{public}s", bundleName.c_str()); |
| 1628 | return; | 1628 | return; |