]> git.ipfire.org Git - thirdparty/grub.git/commit
disk: Check if returned pointer for allocated memory is NULL
authorAlec Brown <alec.r.brown@oracle.com>
Wed, 22 Jan 2025 02:55:11 +0000 (02:55 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 13 Feb 2025 14:45:56 +0000 (15:45 +0100)
commit33bd6b5ac5c77b346769ab5284262f94e695e464
tree0182b72fd92cec5091a23f71c1d74b9947f457c0
parentd8151f98331ee4d15fcca59edffa59246d8fc15f
disk: Check if returned pointer for allocated memory is NULL

When using grub_malloc(), grub_zalloc() or grub_calloc(), these functions can
fail if we are out of memory. After allocating memory we should check if these
functions returned NULL and handle this error if they did.

On the occasion make a NULL check in ATA code more obvious.

Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/disk/ata.c
grub-core/disk/ieee1275/obdisk.c
grub-core/disk/ldm.c
grub-core/disk/lvm.c
grub-core/disk/memdisk.c