[dm- devel][PATCH V2]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In disassemble_status func, for dealing with selector args,
word is allocated by get_word func. However, word is not freed.
Then a memory leak occurs.

Here, we call FREE(word) to free word.

Fixes: 35ad40b4 ('leastpending IO loadbalancing is not displayed properly')
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx>
Signed-off-by: lixiaokeng <lixiaokeng@xxxxxxxxxx>
Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 libmultipath/dmparser.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 3dc77242..33f47405 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -580,10 +580,15 @@ int disassemble_status(char *params, struct multipath *mpp)
 				if (!strncmp(mpp->selector,
 					     "least-pending", 13)) {
 					p += get_word(p, &word);
+
+					if (!word)
+						return 1;
+
 					if (sscanf(word,"%d:*d",
 						   &def_minio) == 1 &&
 					    def_minio != mpp->minio)
 							mpp->minio = def_minio;
+					FREE(word);
 				} else
 					p += get_word(p, NULL);
 			}
-- 
2.24.0.windows.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux