git: bce9319884e6 - stable/12 - insert_zfs() is missing NULL pointer check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Oct 2021 01:16:34 UTC
The branch stable/12 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=bce9319884e6300a55445423bf5451f74d44c989
commit bce9319884e6300a55445423bf5451f74d44c989
Author: Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-02-20 09:00:20 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 01:15:59 +0000
insert_zfs() is missing NULL pointer check
Add missing check of malloc() result.
(cherry picked from commit 7afa0d95e212a612b2990c975082757c44c3b50f)
---
stand/efi/libefi/efizfs.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/stand/efi/libefi/efizfs.c b/stand/efi/libefi/efizfs.c
index 8b28250f109b..aedb9c2294cd 100644
--- a/stand/efi/libefi/efizfs.c
+++ b/stand/efi/libefi/efizfs.c
@@ -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