From: Darren Kenny Date: Fri, 27 Nov 2020 15:41:44 +0000 (+0000) Subject: commands/probe: Fix a resource leak when probing disks X-Git-Tag: grub-2.06-rc1~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fc860bb76bb;p=thirdparty%2Fgrub.git 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 Reviewed-by: Daniel Kiper --- 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;