[PATCH] mpathpersist:check variable 'conf' before using it

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

 



From: "tang.wenji" <tang.wenji@xxxxxxxxxx>

If the variable 'conf' is NULL, the program should exit.

Signed-off-by: tang.wenji <tang.wenji@xxxxxxxxxx>
---
 mpathpersist/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 8e8cc35..5863082 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -105,6 +105,11 @@ int main (int argc, char * argv[])
 
 	udev = udev_new();
 	conf = mpath_lib_init(udev);
+	if(!conf) {
+		udev_unref(udev);
+		exit(1);
+	}
+	
 	memset(transportids, 0, MPATH_MX_TIDS * sizeof(struct transportid));
 	multipath_conf = conf;
 
-- 
2.8.1.windows.1

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