From: Vincent Stehlé Date: Tue, 1 Apr 2025 11:15:00 +0000 (+0200) Subject: efi_loader: handle malloc() errors X-Git-Tag: v2025.07-rc1~80^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dc04803b05ff189619d46acd137a47bedaf6193;p=pandora-u-boot.git 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é Cc: Heinrich Schuchardt Cc: Ilias Apalodimas Cc: Tom Rini Reviewed-by: Ilias Apalodimas --- diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c index 44235970a7c..330d7c5830b 100644 --- a/lib/efi_loader/efi_hii.c +++ b/lib/efi_loader/efi_hii.c @@ -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);