nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0200-blscfg-don-t-dynamically-allocate-default_blsdir.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Will Thompson <wjt@endlessm.com>
d9d99f
Date: Wed, 11 Jul 2018 15:01:45 +0100
d9d99f
Subject: [PATCH] blscfg: don't dynamically allocate default_blsdir
d9d99f
d9d99f
Signed-off-by: Will Thompson <wjt@endlessm.com>
d9d99f
---
d9d99f
 grub-core/commands/blscfg.c | 9 +++------
d9d99f
 1 file changed, 3 insertions(+), 6 deletions(-)
d9d99f
d9d99f
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
d9d99f
index 82fb6cdd182..b61dddb7f43 100644
d9d99f
--- a/grub-core/commands/blscfg.c
d9d99f
+++ b/grub-core/commands/blscfg.c
d9d99f
@@ -623,7 +623,7 @@ static int find_entry (const char *filename,
d9d99f
   grub_file_t f = NULL;
d9d99f
   char *grubenv_path = NULL;
d9d99f
   grub_envblk_t env = NULL;
d9d99f
-  char *default_blsdir = NULL;
d9d99f
+  const char *default_blsdir = NULL;
d9d99f
   grub_fs_t blsdir_fs = NULL;
d9d99f
   grub_device_t blsdir_dev = NULL;
d9d99f
   const char *blsdir = NULL;
d9d99f
@@ -643,10 +643,9 @@ static int find_entry (const char *filename,
d9d99f
 
d9d99f
   // set a default blsdir
d9d99f
   if (info->platform == PLATFORM_EMU)
d9d99f
-    default_blsdir = grub_xasprintf ("%s%s", GRUB_BOOT_DEVICE,
d9d99f
-				     GRUB_BLS_CONFIG_PATH);
d9d99f
+    default_blsdir = GRUB_BOOT_DEVICE GRUB_BLS_CONFIG_PATH;
d9d99f
   else
d9d99f
-    default_blsdir = grub_xasprintf ("%s", GRUB_BLS_CONFIG_PATH);
d9d99f
+    default_blsdir = GRUB_BLS_CONFIG_PATH;
d9d99f
 
d9d99f
   grub_env_set ("blsdir", default_blsdir);
d9d99f
   grub_dprintf ("blscfg", "default_blsdir: \"%s\"\n", default_blsdir);
d9d99f
@@ -788,8 +787,6 @@ finish:
d9d99f
   if (f)
d9d99f
     grub_file_close (f);
d9d99f
 
d9d99f
-  grub_free (default_blsdir);
d9d99f
-
d9d99f
   return 0;
d9d99f
 }
d9d99f