1 Star 0 Fork 19

cenhuilin/mdadm

forked from src-openEuler/mdadm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0018-fix-memory-leak-in-file-mdadm.patch 890 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhangyaqi 提交于 2024-06-06 15:50 . Fix memory leak in file mdadm
From e62a561ee8b7157a2390eab215dcef6240bd7b03 Mon Sep 17 00:00:00 2001
From: Guanqin Miao <miaoguanqin@huawei.com>
Date: Mon, 24 Apr 2023 16:06:37 +0800
Subject: Fix memory leak in file mdadm
When we test mdadm with asan, we found some memory leaks in mdadm.c
We fix these memory leaks based on code logic.
Signed-off-by: Guanqin Miao <miaoguanqin@huawei.com>
Signed-off-by: Li Xiao Keng <lixiaokeng@huawei.com>
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
---
mdadm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mdadm.c b/mdadm.c
index 26299b2..f0016f6 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1775,6 +1775,10 @@ int main(int argc, char *argv[])
autodetect();
break;
}
+ if (ss) {
+ ss->ss->free_super(ss);
+ free(ss);
+ }
if (locked)
cluster_release_dlmlock();
close_fd(&mdfd);
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cenhuilin/mdadm.git
git@gitee.com:cenhuilin/mdadm.git
cenhuilin
mdadm
mdadm
master

搜索帮助