From: Darren Kenny <darren.ke...@oracle.com>

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.ke...@oracle.com>
Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com>
---
 grub-core/commands/probe.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/grub-core/commands/probe.c b/grub-core/commands/probe.c
index 573bdf603..e53b61178 100644
--- a/grub-core/commands/probe.c
+++ b/grub-core/commands/probe.c
@@ -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;
-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to