kern/efi: Fix memory leak on failure

Free the memory allocated to name before returning on failure.

Fixes: CID 296222

Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Patch-Name: 2021-02-security/020-kern-efi-Fix-memory-leak-on-failure.patch
This commit is contained in:
Darren Kenny 2020-11-05 10:15:25 +00:00 committed by Colin Watson
parent 967b95c4e3
commit 42b46cb07f

View File

@ -416,6 +416,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
{ {
grub_error (GRUB_ERR_OUT_OF_RANGE, grub_error (GRUB_ERR_OUT_OF_RANGE,
"malformed EFI Device Path node has length=%d", len); "malformed EFI Device Path node has length=%d", len);
grub_free (name);
return NULL; return NULL;
} }