multipathd: fix memory leak in reconfigure()
PATCH 1/1 multipathd: fix memory leak in reconfigure()
From: "tang.junhui" <[email protected]>
Problem:
Memory leak exists in reconfigure() when multipathd command reconfigure is executed.
Reasons:
* The following judgment condition is not satisfied when there is no path, free_pathvec() is not called to free the vector of vecs->pathvec:
if (VECTOR_SIZE(vecs->pathvec))
free_pathvec(vecs->pathvec, FREE_PATHS);
* Then the vecs->pathvec is set to NULL, so the vector memory which
vecs->pathvec pointed to is leaked:
vecs->pathvec = NULL;--- multipathd/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
multipathd/main.c +1 -3
@@ -1997,9 +1997,7 @@ reconfigure (struct vectors * vecs)if (VECTOR_SIZE (vecs->mpvec))remove_maps_and_stop_waiters (vecs); -if (VECTOR_SIZE (vecs->pathvec)) -free_pathvec (vecs->pathvec,FREE_PATHS ); - +free_pathvec (vecs->pathvec,FREE_PATHS ); vecs->pathvec =NULL ;/* Re-read any timezone changes */
Signature · 4 lines
2.8.1.windows.1 -------------------------------------------------------- ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s). If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited. If you have received this mail in error, please delete it and notify us immediately.
Merged.
Thanks.
Quoted 52 lines · On Mon, Jul 18, 2016 at 2:14 PM, <[email protected]> wrote:
From: "tang.junhui" <[email protected]>
Problem:
Memory leak exists inreconfigure()when multipathd command reconfigure is executed.Reasons:
* The following judgment condition is not satisfied when there is no path,free_pathvec()is not called to free the vector ofvecs->pathvec:if (VECTOR_SIZE(vecs->pathvec)) free_pathvec(vecs->pathvec, FREE_PATHS); * Then the vecs->pathvec is set to NULL, so the vector memory which vecs->pathvec pointed to is leaked: vecs->pathvec = NULL;Signed-off-by tang.junhui <[email protected]>--- multipathd/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)multipathd/main.c +1
-4@@ -1997,9 +1997,7 @@ reconfigure (struct vectors * vecs)if (VECTOR_SIZE (vecs->mpvec))remove_maps_and_stop_waiters (vecs); -if (VECTOR_SIZE (vecs->pathvec)) -free_pathvec (vecs->pathvec,FREE_PATHS ); - +free_pathvec (vecs->pathvec,FREE_PATHS ); vecs->pathvec =NULL ;/* Re-read any timezone changes */ --2.8.1.windows.1
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s). If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited. If you have received this mail in error, please delete it and notify us immediately.--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel