mirror of
http://cgit.git.savannah.gnu.org/git/grub.git
synced 2026-04-28 06:33:17 +00:00
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:
committed by
Daniel Kiper
parent
8b6f528e52
commit
1fc860bb76
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user