代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/multipath-tools 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From db72d840682d15abb2e6694704a91200e513dbac Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 20:33:53 +0800
Subject: [PATCH 5/5] libmultipath: fix memory leak in disassemble_map
---
libmultipath/dmparser.c | 12 ++++++++++--
libmultipath/structs_vec.c | 10 ++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 620f507..1558c4e 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -142,6 +142,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
int def_minio = 0;
struct path * pp;
struct pathgroup * pgp;
+ int pp_unfound;
p = params;
@@ -291,6 +292,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
char devname[FILE_NAME_SIZE];
pp = NULL;
+ pp_unfound = 0;
p += get_word(p, &word);
if (!word)
@@ -310,6 +312,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
}
if (!pp) {
+ pp_unfound = 1;
pp = alloc_path();
if (!pp)
@@ -322,8 +325,10 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
WWID_SIZE);
}
/* Only call this in multipath client mode */
- if (!is_daemon && store_path(pathvec, pp))
+ if (!is_daemon && store_path(pathvec, pp)) {
+ free_path(pp);
goto out1;
+ }
} else {
if (!strlen(pp->wwid) &&
strlen(mpp->wwid))
@@ -332,8 +337,11 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
}
FREE(word);
- if (store_path(pgp->paths, pp))
+ if (store_path(pgp->paths, pp)) {
+ if (pp_unfound)
+ free_path(pp);
goto out;
+ }
/*
* Update wwid for multipaths which are not setup
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 6c42824..828aef2 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -252,6 +252,16 @@ void sync_paths(struct multipath *mpp, vector pathvec)
update_mpp_paths(mpp, pathvec);
vector_foreach_slot (mpp->paths, pp, i)
pp->mpp = mpp;
+
+ vector_foreach_slot (mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ if ((find_slot(mpp->paths, pp) == -1) \
+ && (find_slot(pathvec, pp) == -1)) {
+ vector_del_slot(pgp->paths, j--);
+ free_path(pp);
+ }
+ }
+ }
}
int
--
2.19.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。