[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 1/5] commands/efi/efifwsetup: Add missing grub_free()s
From: |
Robbie Harwood |
Subject: |
[PATCH v4 1/5] commands/efi/efifwsetup: Add missing grub_free()s |
Date: |
Fri, 19 Aug 2022 16:54:40 -0400 |
Each call of grub_efi_get_variable() needs a grub_free().
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/commands/efi/efifwsetup.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/grub-core/commands/efi/efifwsetup.c
b/grub-core/commands/efi/efifwsetup.c
index eaca032838..b5b1f106c6 100644
--- a/grub-core/commands/efi/efifwsetup.c
+++ b/grub-core/commands/efi/efifwsetup.c
@@ -44,6 +44,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
if (old_os_indications != NULL && oi_size == sizeof (os_indications))
os_indications |= *old_os_indications;
+ grub_free (old_os_indications);
+
status = grub_efi_set_variable ("OsIndications", &global, &os_indications,
sizeof (os_indications));
if (status != GRUB_ERR_NONE)
@@ -62,17 +64,20 @@ efifwsetup_is_supported (void)
grub_efi_uint64_t *os_indications_supported = NULL;
grub_size_t oi_size = 0;
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+ grub_boolean_t ret = 0;
grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size,
(void **) &os_indications_supported);
if (!os_indications_supported)
- return 0;
+ goto done;
if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI)
- return 1;
+ ret = 1;
- return 0;
+ done:
+ grub_free (os_indications_supported);
+ return ret;
}
GRUB_MOD_INIT (efifwsetup)
--
2.35.1
- [PATCH 0/2] grub.texi: Document fwsetup and fix typo, Robbie Harwood, 2022/08/19
- [PATCH v4 3/5] templates: Check for EFI at runtime instead of config generation time, Robbie Harwood, 2022/08/19
- [PATCH v4 0/5] Improve logic to check for fwsetup support, Robbie Harwood, 2022/08/19
- [PATCH v4 5/5] Don't display a uefi-firmware entry if it's not supported, Robbie Harwood, 2022/08/19
- [PATCH 2/2] grub.texi: Fix mismatched brackets in halt command, Robbie Harwood, 2022/08/19
- [PATCH 1/1] grub.texi: Fix mismatched brackets in halt command, Robbie Harwood, 2022/08/19
- [PATCH 1/2] grub.text: Document fwsetup command, Robbie Harwood, 2022/08/19
- [PATCH v4 1/5] commands/efi/efifwsetup: Add missing grub_free()s,
Robbie Harwood <=
- [PATCH v4 4/5] efi: Print an error if boot to firmware setup is not supported, Robbie Harwood, 2022/08/19
- [PATCH v4 2/5] Make all grub_efi_guid_t variables static, Robbie Harwood, 2022/08/19