From 72bbd8046a55f4a7995535696f375e465ccb0237 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sat, 24 Jan 2015 21:15:14 +0100 Subject: [PATCH] commands/macbless: Handle device opening errors correctly. Wrong variable was checked for errors. Found by: Coverity scan. --- grub-core/commands/macbless.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/commands/macbless.c b/grub-core/commands/macbless.c index f9e01b6f9..18efa1a84 100644 --- a/grub-core/commands/macbless.c +++ b/grub-core/commands/macbless.c @@ -183,7 +183,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) { char *device_name; char *path = 0; - grub_device_t dev; + grub_device_t dev = 0; grub_err_t err; if (argc != 1) @@ -197,7 +197,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args) else path = path + 1; - if (!path || *path == 0 || !device_name) + if (!path || *path == 0 || !dev) { if (dev) grub_device_close (dev);