All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmultipath: fix memory leak in reconfigure
@ 2016-07-04  5:45 tang.junhui
  0 siblings, 0 replies; only message in thread
From: tang.junhui @ 2016-07-04  5:45 UTC (permalink / raw)
  To: bmarzins, christophe_varoqui; +Cc: dm-devel, 10072500, 10074136


[-- Attachment #1.1.1: Type: text/plain, Size: 1534 bytes --]

Problem:

 * Memory leak exists in reconfigure function when multipathd command 
"reconfigure" is executed.

Reasons:

 * The following judgement 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;


Please review the solutions to the problem in the attachment:


 
唐军辉  Tang Junhui
主机侧软件开发  Host-side Software Development
无线研究院 / 虚拟化长沙开发部  NIV Changsha Development Dept/Wireless 
Product R&D Institute/Wireless Product Operation



湖南长沙岳麓区尖山路中电软件园8楼 410205
8/F,CEC Software Park,NO.39, Jianshan Road, Lugu High-tech Industrial
Center, Yuelu District, Changsha, P.R. China
T: 0731 xxxxx
M: +86 15616251617
E: tangjunhui@zte.com.cn
www.zte.com.cn

--------------------------------------------------------
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.

[-- Attachment #1.1.2: Type: text/html, Size: 3188 bytes --]

[-- Attachment #1.2: Type: image/gif, Size: 6015 bytes --]

[-- Attachment #1.3: Type: image/gif, Size: 2054 bytes --]

[-- Attachment #2: [dm-devel] [PATCH] libmultipath fix memory leak in reconfigure function.patch --]
[-- Type: application/octet-stream, Size: 844 bytes --]

From 5049cfaf2992c3755b948dfabe615891bf2ac2b2 Mon Sep 17 00:00:00 2001
From: 10074136 <tang.junhui@zte.com.cn>
Date: Mon, 27 Jun 2016 19:08:46 +0800
Subject: [PATCH 12/12] fix memory leakage in reconfigure

Change-Id: I6320b0838ef9e93e3bc166fce84f45746fa48b47
---
 multipathd/main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index b86374f..6d9c603 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1866,12 +1866,10 @@ 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;
+	
 	conf = NULL;
-
 	/* Re-read any timezone changes */
 	tzset();
 
-- 
2.7.0.windows.2


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-04  5:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04  5:45 [PATCH] libmultipath: fix memory leak in reconfigure tang.junhui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.