emu: Make grub_free(NULL) safe
The grub_free() implementation in grub-core/kern/mm.c safely handles NULL pointers, and code at many places depends on this. We don't know that the same is true on all host OSes, so we need to handle the same behavior in grub-emu's implementation. Signed-off-by: Peter Jones <pjones@redhat.com> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
879c4a8342
commit
b73cee7f1f
1 changed files with 2 additions and 1 deletions
|
@ -60,7 +60,8 @@ grub_zalloc (grub_size_t size)
|
||||||
void
|
void
|
||||||
grub_free (void *ptr)
|
grub_free (void *ptr)
|
||||||
{
|
{
|
||||||
free (ptr);
|
if (ptr)
|
||||||
|
free (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
Loading…
Reference in a new issue