efi_loader: efi_dp_part_node check dp_alloc return value
dp_alloc() may return NULL. This needs to be caught.
Fixes: 98d48bdf415e ("efi_loader: provide a function to create a partition node")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 39ea1a6..79b2809 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -415,6 +415,11 @@
struct efi_handler *handler;
void *protocol_interface;
+ if (!node) {
+ ret = EFI_OUT_OF_RESOURCES;
+ goto error;
+ }
+
/* Parent must expose EFI_BLOCK_IO_PROTOCOL */
ret = efi_search_protocol(parent, &efi_block_io_guid, &handler);
if (ret != EFI_SUCCESS)