diff --git a/interfaces/kits/napi/src/cm_napi_user_trusted_cert.cpp b/interfaces/kits/napi/src/cm_napi_user_trusted_cert.cpp index 0e0cc70895bfd613e9be7d93d73a50f115a66253..2ef6fd15875d09c4b3dc74db4c0597a585087dc2 100644 --- a/interfaces/kits/napi/src/cm_napi_user_trusted_cert.cpp +++ b/interfaces/kits/napi/src/cm_napi_user_trusted_cert.cpp @@ -517,14 +517,14 @@ napi_value CMNapiInstallUserTrustedCertSync(napi_env env, napi_callback_info inf } } while (0); + FreeCmBlob(userCert); if (ret != CM_SUCCESS) { CM_LOG_E("install user cert sync failed, ret = %d", ret); napi_throw(env, GenerateBusinessError(env, ret)); return nullptr; } + napi_value result = ConvertResultCertUri(env, &certUri); - FreeCmBlob(userCert); - CM_LOG_I("install user trusted cert sync end"); return result; } diff --git a/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_key_operation.c b/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_key_operation.c index 495e251180d819ba2b6462bbe0596ca04883a351..d21841d779445ec4d3ceec7aada1ec201eb16734 100755 --- a/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_key_operation.c +++ b/services/cert_manager_standard/cert_manager_engine/main/core/src/cert_manager_key_operation.c @@ -169,7 +169,7 @@ static int32_t GetKeyAlias(struct HksBlob *keyAlias, struct CmBlob *encodeTarget static uint32_t TranslateToHuksLevel(enum CmAuthStorageLevel level) { uint32_t res = HKS_AUTH_STORAGE_LEVEL_DE; - for (int i = 0; i < CM_ARRAY_SIZE(g_cmLevelProperty); ++i) { + for (uint32_t i = 0; i < CM_ARRAY_SIZE(g_cmLevelProperty); ++i) { if (level == g_cmLevelProperty[i].cmProperty) { res = (uint32_t)g_cmLevelProperty[i].huksProperty; }