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