insert_zfs() is missing NULL pointer check

Add missing check of malloc() result.
This commit is contained in:
Toomas Soome 2020-02-20 09:00:20 +00:00
parent 79cbcdcf3e
commit 7afa0d95e2

View File

@ -86,9 +86,11 @@ insert_zfs(EFI_HANDLE handle, uint64_t guid)
zfsinfo_t *zi;
zi = malloc(sizeof(zfsinfo_t));
zi->zi_handle = handle;
zi->zi_pool_guid = guid;
STAILQ_INSERT_TAIL(&zfsinfo, zi, zi_link);
if (zi != NULL) {
zi->zi_handle = handle;
zi->zi_pool_guid = guid;
STAILQ_INSERT_TAIL(&zfsinfo, zi, zi_link);
}
}
void