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

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