加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0091-fix-alloc-not-free.patch 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
From 053024d4cbedc106276e25a7ace5d833f8a62dea Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Wed, 20 Dec 2023 01:37:12 +0000
Subject: [PATCH] fix alloc not free
---
src/lstack/core/lstack_cfg.c | 2 ++
src/lstack/core/lstack_dpdk.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 6324c97..f639473 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -1185,11 +1185,13 @@ static int32_t parse_bond_slave_mac(void)
if (k >= GAZELLE_MAX_BOND_NUM) {
LSTACK_PRE_LOG(LSTACK_ERR, "cfg: too many slave mac address. The maximum number of mac address is %d.\n",
GAZELLE_MAX_BOND_NUM);
+ free(bond_slave_mac_tmp);
return -EINVAL;
}
ret = str_to_eth_addr(mac_addr, g_config_params.bond_slave_mac_addr[k].addr_bytes);
if (ret != 0) {
LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid device name %s ret=%d.\n", mac_addr, ret);
+ free(bond_slave_mac_tmp);
return ret;
}
mac_addr = strtok_s(NULL, delim, &tmp);
diff --git a/src/lstack/core/lstack_dpdk.c b/src/lstack/core/lstack_dpdk.c
index e20dea8..6933ecd 100644
--- a/src/lstack/core/lstack_dpdk.c
+++ b/src/lstack/core/lstack_dpdk.c
@@ -553,11 +553,13 @@ int32_t dpdk_ethdev_init(int port_id, bool bond_port)
int slave_id = rte_eth_bond_primary_get(port_id);
if (slave_id < 0) {
LSTACK_LOG(ERR, LSTACK, "dpdk get bond primary port failed port = %d\n", slave_id);
+ free(eth_params);
return slave_id;
}
ret = rte_eth_dev_info_get(slave_id, &slave_dev_info);
if (ret != 0) {
LSTACK_LOG(ERR, LSTACK, "dpdk get bond dev info failed ret = %d\n", ret);
+ free(eth_params);
return ret;
}
dev_info.rx_offload_capa = slave_dev_info.rx_offload_capa;
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化