nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0202-blscfg-remove-NULL-guards-around-grub_free.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Will Thompson <wjt@endlessm.com>
d9d99f
Date: Thu, 12 Jul 2018 10:14:43 +0100
d9d99f
Subject: [PATCH] blscfg: remove NULL guards around grub_free()
d9d99f
d9d99f
The internal implementation of grub_free() is NULL-safe. In emu builds,
d9d99f
it just delegates to the host's free(), which is specified by ANSI C to
d9d99f
be NULL-safe.
d9d99f
d9d99f
Signed-off-by: Will Thompson <wjt@endlessm.com>
d9d99f
---
d9d99f
 grub-core/commands/blscfg.c | 23 ++++++-----------------
d9d99f
 1 file changed, 6 insertions(+), 17 deletions(-)
d9d99f
d9d99f
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
b71686
index 9c928dda4..bd78559ef 100644
d9d99f
--- a/grub-core/commands/blscfg.c
d9d99f
+++ b/grub-core/commands/blscfg.c
d9d99f
@@ -600,23 +600,12 @@ static void create_entry (struct bls_entry *entry, const char *cfgfile)
d9d99f
   grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0);
d9d99f
 
d9d99f
 finish:
d9d99f
-  if (initrd)
d9d99f
-    grub_free (initrd);
d9d99f
-
d9d99f
-  if (initrds)
d9d99f
-    grub_free (initrds);
d9d99f
-
d9d99f
-  if (classes)
d9d99f
-    grub_free (classes);
d9d99f
-
d9d99f
-  if (args)
d9d99f
-    grub_free (args);
d9d99f
-
d9d99f
-  if (argv)
d9d99f
-    grub_free (argv);
d9d99f
-
d9d99f
-  if (src)
d9d99f
-    grub_free (src);
d9d99f
+  grub_free (initrd);
d9d99f
+  grub_free (initrds);
d9d99f
+  grub_free (classes);
d9d99f
+  grub_free (args);
d9d99f
+  grub_free (argv);
d9d99f
+  grub_free (src);
d9d99f
 }
d9d99f
 
d9d99f
 struct find_entry_info {