diff options
author | Vincent Stehlé <vincent.stehle@arm.com> | 2025-04-01 13:15:00 +0200 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2025-04-11 13:25:27 +0200 |
commit | 2dc04803b05ff189619d46acd137a47bedaf6193 (patch) | |
tree | 88283a2b94d69630d11ed9815a72950de26a8bea /lib/efi_loader/efi_hii.c | |
parent | f5e0f2198ec1226b4fd0121439facc30cb886a2a (diff) |
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>
Diffstat (limited to 'lib/efi_loader/efi_hii.c')
-rw-r--r-- | lib/efi_loader/efi_hii.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |