提交 2f4caf81 编写于 作者: S shi_peng_tao

设备安全等级管理开发指南开发示例代码if分支return前添加释放内存语句;更新安全中指向设备安全等级管理开发指南文件的链接

Signed-off-by: Nshi_peng_tao <shipengtao@huawei.com>
上级 710a7c17
......@@ -94,7 +94,8 @@ All the APIs are native C interfaces for implementing underlying capabilities an
// Obtain the device security level from the device security level information.
ret = GetDeviceSecurityLevelValue(info, &level);
if (ret == SUCCESS) {
// The operation is successful.
//The level is successfully queried.
FreeDeviceSecurityInfo(info);
return;
}
// Release the memory before the processing is complete.
......@@ -126,6 +127,7 @@ void CheckDestDeviceSecurityLevel(const DeviceIdentify *device, RequestOption *o
ret = GetDeviceSecurityLevelValue(info, &level);
if (ret != SUCCESS) {
// Failed to obtain the security level. You can develop a retry process as required.
FreeDeviceSecurityInfo(info);
return;
}
// After the device security level is successfully obtained, check the lowest security level required for the current operation.
......@@ -151,6 +153,7 @@ void DeviceSecurityInfoCallback(const DeviceIdentify *identify, struct DeviceSec
int32_t ret = GetDeviceSecurityLevelValue(info, &level);
if (ret != SUCCESS) {
// Failed to obtain the information. You can develop a retry process as required.
FreeDeviceSecurityInfo(info);
return;
}
// After the device security level is successfully obtained, check the lowest security level required for the current operation.
......
......@@ -94,7 +94,8 @@ OpenHarmony设备的默认安全等级为SL1,设备制造商可以根据设备
// 从设备安全等级信息中提取设备安全等级字段
ret = GetDeviceSecurityLevelValue(info, &level);
if (ret == SUCCESS) {
// 查询成功。
// 成功查询到相关等级。
FreeDeviceSecurityInfo(info);
return;
}
// 结束处理前,需要释放内存
......@@ -126,6 +127,7 @@ void CheckDestDeviceSecurityLevel(const DeviceIdentify *device, RequestOption *o
ret = GetDeviceSecurityLevelValue(info, &level);
if (ret != SUCCESS) {
// 提取信息失败, 此场景建议开发者根据实际情况进行重试
FreeDeviceSecurityInfo(info);
return;
}
// 成功获取到设备安全等级,确认当前操作允许的最低安全等级
......@@ -151,6 +153,7 @@ void DeviceSecurityInfoCallback(const DeviceIdentify *identify, struct DeviceSec
int32_t ret = GetDeviceSecurityLevelValue(info, &level);
if (ret != SUCCESS) {
// 获取信息失败。此场景建议开发者根据实际情况进行重试
FreeDeviceSecurityInfo(info);
return;
}
// 成功获取到设备安全等级,确认当前操作允许的最低安全等级
......
......@@ -10,4 +10,4 @@
- **[IPC通信鉴权开发指导](subsys-security-communicationverify.md)**
- **[设备安全等级管理开发指南](subsys-security-dslm.md)**
\ No newline at end of file
- **[设备安全等级管理开发指南](subsys-security-devicesecuritylevel.md)**
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册