commands/probe: Fix a resource leak when probing disks

Every other return statement in this code is calling grub_device_close()
to clean up dev before returning. This one should do that too.

Fixes: CID 292443

Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Darren Kenny 2020-11-27 15:41:44 +00:00 committed by Daniel Kiper
parent 8b6f528e52
commit 1fc860bb76

View File

@ -111,7 +111,11 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args)
grub_disk_t disk = grub_disk_open(dev->disk->name);
if (!disk)
return grub_errno;
{
grub_device_close (dev);
return grub_errno;
}
if (grub_strcmp(dev->disk->partition->partmap->name, "gpt") == 0)
{
struct grub_gpt_partentry entry;