From: Vladimir Serbinenko Date: Sat, 24 Jan 2015 20:15:14 +0000 (+0100) Subject: commands/macbless: Handle device opening errors correctly. X-Git-Tag: 2.02-beta3~531 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72bbd8046a55f4a7995535696f375e465ccb0237;p=thirdparty%2Fgrub.git commands/macbless: Handle device opening errors correctly. Wrong variable was checked for errors. Found by: Coverity scan. --- 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);