From 0828095b1600fe19dc1112fbcde84a3cbfa8b2b5 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 19 Jul 2013 16:43:35 +0200 Subject: [PATCH] block: fix possible NULL pointer dereference in mount_device() --- block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index edfa627..860a95c 100644 --- a/block.c +++ b/block.c @@ -481,11 +481,13 @@ static void check_filesystem(struct blkid_struct_probe *pr) static int mount_device(struct blkid_struct_probe *pr, int hotplug) { struct mount *m; - char *device = basename(pr->dev); + char *device; if (!pr) return -1; + device = basename(pr->dev); + if (!strcmp(pr->id->name, "swap")) { if (hotplug && !auto_swap) return -1; -- 2.30.2