加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0200-blscfg-don-t-dynamically-allocate-default_blsdir.patch 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Will Thompson <wjt@endlessm.com>
Date: Wed, 11 Jul 2018 15:01:45 +0100
Subject: [PATCH] blscfg: don't dynamically allocate default_blsdir
Signed-off-by: Will Thompson <wjt@endlessm.com>
---
grub-core/commands/blscfg.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index 82fb6cdd1..b61dddb7f 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -623,7 +623,7 @@ static int find_entry (const char *filename,
grub_file_t f = NULL;
char *grubenv_path = NULL;
grub_envblk_t env = NULL;
- char *default_blsdir = NULL;
+ const char *default_blsdir = NULL;
grub_fs_t blsdir_fs = NULL;
grub_device_t blsdir_dev = NULL;
const char *blsdir = NULL;
@@ -643,10 +643,9 @@ static int find_entry (const char *filename,
// set a default blsdir
if (info->platform == PLATFORM_EMU)
- default_blsdir = grub_xasprintf ("%s%s", GRUB_BOOT_DEVICE,
- GRUB_BLS_CONFIG_PATH);
+ default_blsdir = GRUB_BOOT_DEVICE GRUB_BLS_CONFIG_PATH;
else
- default_blsdir = grub_xasprintf ("%s", GRUB_BLS_CONFIG_PATH);
+ default_blsdir = GRUB_BLS_CONFIG_PATH;
grub_env_set ("blsdir", default_blsdir);
grub_dprintf ("blscfg", "default_blsdir: \"%s\"\n", default_blsdir);
@@ -788,8 +787,6 @@ finish:
if (f)
grub_file_close (f);
- grub_free (default_blsdir);
-
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化