efi_loader: handle malloc() errors

The new_packagelist() function of the HII Protocols implementation is
calling malloc() without checking its return code; fix this.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Vincent Stehlé
2025-04-01 13:15:00 +02:00
committed by Heinrich Schuchardt
parent f5e0f2198e
commit 2dc04803b0

View File

@@ -343,6 +343,9 @@ static struct efi_hii_packagelist *new_packagelist(void)
struct efi_hii_packagelist *hii;
hii = malloc(sizeof(*hii));
if (!hii)
return NULL;
list_add_tail(&hii->link, &efi_package_lists);
hii->max_string_id = 0;
INIT_LIST_HEAD(&hii->string_tables);