1 Star 0 Fork 40

geruijun/multipath-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
6006-multipathd-fix-memory-leak-on-error-in-configure.patch 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
wangjufeng 提交于 2020-01-10 17:13 . rename the package
From 3b8da487d534eb49c8c59d1a9c2d6199c0716572 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:14 -0500
Subject: [PATCH] multipathd: fix memory leak on error in configure
If configure fails after allocing mpvec, it must free it. Found by
coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 463b1b82..04dce04c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2278,7 +2278,7 @@ configure (struct vectors * vecs)
ret = path_discovery(vecs->pathvec, DI_ALL);
if (ret < 0) {
condlog(0, "configure failed at path discovery");
- return 1;
+ goto fail;
}
vector_foreach_slot (vecs->pathvec, pp, i){
@@ -2295,7 +2295,7 @@ configure (struct vectors * vecs)
}
if (map_discovery(vecs)) {
condlog(0, "configure failed at map discovery");
- return 1;
+ goto fail;
}
/*
@@ -2309,7 +2309,7 @@ configure (struct vectors * vecs)
force_reload = FORCE_RELOAD_YES;
if (ret) {
condlog(0, "configure failed while coalescing paths");
- return 1;
+ goto fail;
}
/*
@@ -2318,7 +2318,7 @@ configure (struct vectors * vecs)
*/
if (coalesce_maps(vecs, mpvec)) {
condlog(0, "configure failed while coalescing maps");
- return 1;
+ goto fail;
}
dm_lib_release();
@@ -2354,6 +2354,10 @@ configure (struct vectors * vecs)
i--;
}
return 0;
+
+fail:
+ vector_free(mpvec);
+ return 1;
}
int
--
2.11.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/geruijun/multipath-tools.git
git@gitee.com:geruijun/multipath-tools.git
geruijun
multipath-tools
multipath-tools
master

搜索帮助