diff --git a/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h b/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h index 37ece4a1de1bfcc2465f829178583227db28bb0b..3aada4e4344d4edddacd48d09a8f77d369d7db23 100644 --- a/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h +++ b/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +33,6 @@ public: private: void *soHandle_ {nullptr}; - std::shared_ptr distributedModemExt_; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp b/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp index 66cba1aaea742b17440476ab0389a7159a571bc0..03c0bc33656f2bee03949de384d5da559eff1a1e 100644 --- a/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp +++ b/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -50,16 +50,15 @@ std::shared_ptr DHModemContextExt::GetModemExtInstance() { if (soHandle_ == nullptr && GetHandler() != DH_FWK_SUCCESS) { DHLOGE("load modem_ext so failed."); - return distributedModemExt_; + return nullptr; } auto func = (CreateDistributedModemExtImplFuncPtr)dlsym(soHandle_, "CreateDistributedModemExtImplObject"); if (dlerror() != nullptr || func == nullptr) { dlclose(soHandle_); DHLOGE("Create object function is not exist."); - return distributedModemExt_; + return nullptr; } - distributedModemExt_ = std::shared_ptr(func()); - return distributedModemExt_; + return std::shared_ptr(func()); } int32_t DHModemContextExt::UnInit()