5 Star 0 Fork 4

src-openEuler/hikptool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0012-Fix-a-resource-release-bug-in-hikp_roh_get_cam_reg_n.patch 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
veega2022 提交于 2023-05-30 22:10 . sync code for bugfix
From e51911b2c5daa7f9d650849aaa4f389291415255 Mon Sep 17 00:00:00 2001
From: veega2022 <zhuweijia@huawei.com>
Date: Thu, 11 May 2023 09:29:48 +0800
Subject: [PATCH 14/18] Fix a resource release bug in hikp_roh_get_cam_reg_num
Fix a resource release bug in hikp_roh_get_cam_reg_num
Signed-off-by: chenke chenke54@huawei.com
---
net/roh/hikp_roh_mac.c | 6 +++++-
net/roh/hikp_roh_show_bp.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/roh/hikp_roh_mac.c b/net/roh/hikp_roh_mac.c
index 90708b1..43f954c 100644
--- a/net/roh/hikp_roh_mac.c
+++ b/net/roh/hikp_roh_mac.c
@@ -141,6 +141,7 @@ static int hikp_roh_get_cam_reg_num(struct major_cmd_ctrl *self)
struct roh_mac_req_para req_data = { 0 };
struct hikp_cmd_header req_header = { 0 };
struct hikp_cmd_ret *cmd_ret = NULL;
+ uint32_t cam_reg_num;
req_data.bdf = g_roh_mac_param.target.bdf;
hikp_cmd_init(&req_header, ROH_MOD, HIKP_ROH_MAC, CMD_GET_CAM_REG_NUM);
@@ -153,7 +154,10 @@ static int hikp_roh_get_cam_reg_num(struct major_cmd_ctrl *self)
return -EIO;
}
mac_rsp = (struct roh_mac_cam_reg_num *)(cmd_ret->rsp_data);
- return mac_rsp->cam_reg_num;
+ cam_reg_num = mac_rsp->cam_reg_num;
+ free(cmd_ret);
+ cmd_ret = NULL;
+ return cam_reg_num;
}
static int hikp_roh_build_cam(struct major_cmd_ctrl *self, struct cam_table_entry_t *cam_table)
diff --git a/net/roh/hikp_roh_show_bp.c b/net/roh/hikp_roh_show_bp.c
index c89e98b..73a53d8 100644
--- a/net/roh/hikp_roh_show_bp.c
+++ b/net/roh/hikp_roh_show_bp.c
@@ -44,7 +44,7 @@ static int hikp_roh_show_bp(struct major_cmd_ctrl *self)
union bp_val res;
uint8_t flit_bp;
int mac_id;
- int ret;
+ int ret = 0;
struct hikp_cmd_ret *cmd_ret = NULL;
struct hikp_cmd_header req_header = { 0 };
--
2.25.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/hikptool.git
git@gitee.com:src-openeuler/hikptool.git
src-openeuler
hikptool
hikptool
master

搜索帮助