Handle out of memory situation in efi_add_memory_map_pg().
Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map")
Signed-off-by: Heinrich Schuchardt <[email protected]>
---
lib/efi_loader/efi_memory.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index c47a0dc219..fbd20f58ca 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -285,6 +285,8 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64
pages,
++efi_memory_map_key;
newlist = calloc(1, sizeof(*newlist));
+ if (!newlist)
+ return EFI_OUT_OF_RESOURCES;
newlist->desc.type = memory_type;
newlist->desc.physical_start = start;
newlist->desc.virtual_start = start;
--
2.40.1