efi: Fix several memory leaks of UEFI handles

Fix possible and absolute memory leaks of "handles"
returned by grub_efi_locate_handle() using grub_malloc().

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Khalid Ali authored and Daniel Kiper committed 2025-12-21 16:41:46 +01:00
1 parent c477a95519
commit 0f0899c329
4 files changed
+6 -3

No files matched your search

+2 -2
View File
@@ -169,13 +169,13 @@ grub_efiserial_init (void)
port = grub_zalloc (sizeof (*port));
if (!port)
return;
break;
port->name = grub_malloc (sizeof ("efiXXXXXXXXXXXXXXXXXXXX"));
if (!port->name)
{
grub_free (port);
return;
break;
}
grub_snprintf (port->name, sizeof ("efiXXXXXXXXXXXXXXXXXXXX"),
"efi%d", num_serial++);