Blame SOURCES/0302-emu-make-grub_free-NULL-safe.patch

80913e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
80913e
From: Peter Jones <pjones@redhat.com>
80913e
Date: Sun, 19 Jul 2020 16:08:08 -0400
80913e
Subject: [PATCH] emu: make grub_free(NULL) safe
80913e
80913e
The grub_free() implementation in kern/mm.c safely handles NULL
80913e
pointers, and code at many places depends on this.  We don't know that
80913e
the same is true on all host OSes, so we need to handle the same
80913e
behavior in grub-emu's implementation.
80913e
80913e
Signed-off-by: Peter Jones <pjones@redhat.com>
80913e
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
80913e
Upstream-commit-id: 96bb109e658
80913e
---
80913e
 grub-core/kern/emu/mm.c | 3 ++-
80913e
 1 file changed, 2 insertions(+), 1 deletion(-)
80913e
80913e
diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c
b32e65
index 145b01d37..4d1046a21 100644
80913e
--- a/grub-core/kern/emu/mm.c
80913e
+++ b/grub-core/kern/emu/mm.c
80913e
@@ -60,7 +60,8 @@ grub_zalloc (grub_size_t size)
80913e
 void
80913e
 grub_free (void *ptr)
80913e
 {
80913e
-  free (ptr);
80913e
+  if (ptr)
80913e
+    free (ptr);
80913e
 }
80913e
 
80913e
 void *