grub2/0384-blscfg-don-t-dynamically-allocate-default_blsdir.patch
Peter Jones ce0f493268 Rebased to newer upstream for fedora-29
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-07-16 15:54:21 -04:00

46 lines
1.5 KiB
Diff

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 243fcda57f9..1d0e6ceaf7d 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;
}