efinet_dev_init() is missing NULL pointer check

Add missing check of malloc() result.
This commit is contained in:
tsoome 2020-02-20 08:48:34 +00:00
parent 239a5be61c
commit 67dc9f220d

View File

@ -371,6 +371,8 @@ efinet_dev_init()
status = BS->LocateHandle(ByProtocol, &sn_guid, NULL, &sz, NULL);
if (status == EFI_BUFFER_TOO_SMALL) {
handles = (EFI_HANDLE *)malloc(sz);
if (handles == NULL)
return (ENOMEM);
status = BS->LocateHandle(ByProtocol, &sn_guid, NULL, &sz,
handles);
if (EFI_ERROR(status))