libzfs: don't NULL-check infallible allocations

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13229
This commit is contained in:
наб
2022-03-16 19:51:28 +01:00
committed by Brian Behlendorf
parent bc3f12bfac
commit 18dbf5c8c3
13 changed files with 105 additions and 262 deletions
+5 -15
View File
@@ -1572,29 +1572,19 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
*/
if (used == alloc) {
if (alloc == 0) {
if ((sets = zfs_alloc(hdl,
8 * sizeof (struct sets_s))) == NULL)
goto out;
sets = zfs_alloc(hdl,
8 * sizeof (struct sets_s));
alloc = 8;
} else {
void *ptr;
if ((ptr = zfs_realloc(hdl, sets,
sets = zfs_realloc(hdl, sets,
alloc * sizeof (struct sets_s),
alloc * 2 * sizeof (struct sets_s)))
== NULL)
goto out;
sets = ptr;
alloc * 2 * sizeof (struct sets_s));
alloc *= 2;
}
}
if ((sets[used].mountpoint = zfs_strdup(hdl,
entry.mnt_mountp)) == NULL)
goto out;
sets[used].mountpoint = zfs_strdup(hdl, entry.mnt_mountp);
/*
* This is allowed to fail, in case there is some I/O error. It