0 Star 0 Fork 83

t.feng / grub2

forked from src-openEuler / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-commands-efi-efifwsetup-Add-missing-grub_free-s.patch 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
zhangqiumiao 提交于 2022-10-23 22:14 . backport some patches from upstream
From 01d1953fc50764206daad12d9b5dd68721353315 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Thu, 18 Aug 2022 13:50:09 -0400
Subject: commands/efi/efifwsetup: Add missing grub_free()s
Each call of grub_efi_get_variable() needs a grub_free().
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=01d1953fc50764206daad12d9b5dd68721353315
Conflict:NA
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.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 328c45e..50cecb4 100644
--- a/grub-core/commands/efi/efifwsetup.c
+++ b/grub-core/commands/efi/efifwsetup.c
@@ -33,17 +33,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_efi_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;
}
static grub_err_t
@@ -67,6 +70,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)
--
2.19.1
1
https://gitee.com/t_feng/grub2.git
git@gitee.com:t_feng/grub2.git
t_feng
grub2
grub2
master

搜索帮助