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:

committed by
Heinrich Schuchardt

parent
f5e0f2198e
commit
2dc04803b0
@@ -343,6 +343,9 @@ static struct efi_hii_packagelist *new_packagelist(void)
|
|||||||
struct efi_hii_packagelist *hii;
|
struct efi_hii_packagelist *hii;
|
||||||
|
|
||||||
hii = malloc(sizeof(*hii));
|
hii = malloc(sizeof(*hii));
|
||||||
|
if (!hii)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
list_add_tail(&hii->link, &efi_package_lists);
|
list_add_tail(&hii->link, &efi_package_lists);
|
||||||
hii->max_string_id = 0;
|
hii->max_string_id = 0;
|
||||||
INIT_LIST_HEAD(&hii->string_tables);
|
INIT_LIST_HEAD(&hii->string_tables);
|
||||||
|
Reference in New Issue
Block a user