efi_register_handles() is missing NULL pointer check

Add missing check of malloc() result.
This commit is contained in:
Toomas Soome 2020-02-20 09:02:59 +00:00
parent 7afa0d95e2
commit 4a82db5fe7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358163

View File

@ -52,6 +52,8 @@ efi_register_handles(struct devsw *sw, EFI_HANDLE *handles,
nentries += count;
sz = nentries * sizeof(struct entry);
entry = (entry == NULL) ? malloc(sz) : realloc(entry, sz);
if (entry == NULL)
return (ENOMEM);
for (unit = 0; idx < nentries; idx++, unit++) {
entry[idx].handle = handles[unit];
if (aliases != NULL)