commands/macbless: Handle device opening errors correctly.

Wrong variable was checked for errors.

Found by: Coverity scan.
This commit is contained in:
Vladimir Serbinenko 2015-01-24 21:15:14 +01:00
parent e3b3e53f72
commit 72bbd8046a

View file

@ -183,7 +183,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args)
{ {
char *device_name; char *device_name;
char *path = 0; char *path = 0;
grub_device_t dev; grub_device_t dev = 0;
grub_err_t err; grub_err_t err;
if (argc != 1) if (argc != 1)
@ -197,7 +197,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args)
else else
path = path + 1; path = path + 1;
if (!path || *path == 0 || !device_name) if (!path || *path == 0 || !dev)
{ {
if (dev) if (dev)
grub_device_close (dev); grub_device_close (dev);