dcavalca / rpms / grub2

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