diff --git a/frameworks/native/neural_network_core/neural_network_core.cpp b/frameworks/native/neural_network_core/neural_network_core.cpp index c35a71d15887193cbcc9b39a1dc01ac30948521d..6646c3de7f249754a2ff527bb2777a4579028813 100644 --- a/frameworks/native/neural_network_core/neural_network_core.cpp +++ b/frameworks/native/neural_network_core/neural_network_core.cpp @@ -693,6 +693,7 @@ OH_NN_ReturnCode GetModelId(Compilation** compilation) auto ret = GetNnrtModelId(compilationImpl, nnrtService); if (ret != OH_NN_SUCCESS) { LOGE("GetNnrtModelId failed."); + return ret; } return OH_NN_SUCCESS; diff --git a/test/unittest/components/v1_0/device_registrar/device_registrar_test.cpp b/test/unittest/components/v1_0/device_registrar/device_registrar_test.cpp index 95d85bb3bb655ed937e8f6043cd43fdafc566a78..f8c67cd596d37c416855c7f445537834ecb49fb3 100644 --- a/test/unittest/components/v1_0/device_registrar/device_registrar_test.cpp +++ b/test/unittest/components/v1_0/device_registrar/device_registrar_test.cpp @@ -192,7 +192,7 @@ sptr IRegisterDevice::Get(const std::string& serviceName, bool return nullptr; } - auto mockIDevice = std::make_shared(); + auto mockIDevice = OHOS::NeuralNetworkRuntime::CreateSharedPtr(); if (!mockIDevice) { LOGE("Failed to new MockIDeviceImp object."); return nullptr; diff --git a/test/unittest/components/v2_0/device_registrar/device_registrar_test.cpp b/test/unittest/components/v2_0/device_registrar/device_registrar_test.cpp index afda8de182400b3160c0dd1172ed301aa8d91f5d..753e1406380a278841469690119d40037cdee58d 100644 --- a/test/unittest/components/v2_0/device_registrar/device_registrar_test.cpp +++ b/test/unittest/components/v2_0/device_registrar/device_registrar_test.cpp @@ -192,7 +192,7 @@ sptr IRegisterDevice::Get(const std::string& serviceName, bool return nullptr; } - auto mockIDevice = std::make_shared(); + auto mockIDevice = OHOS::NeuralNetworkRuntime::CreateSharedPtr(); if (!mockIDevice) { LOGE("Failed to new MockIDeviceImp object."); return nullptr;