libzfs: util: don't check for allocation errors from infallible zfs_*()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13125
This commit is contained in:
наб 2022-02-20 04:06:43 +01:00 committed by Brian Behlendorf
parent be8e1d81bf
commit f4826a2d46
1 changed files with 3 additions and 11 deletions

View File

@ -1778,16 +1778,10 @@ addlist(libzfs_handle_t *hdl, char *propname, zprop_list_t **listp,
dgettext(TEXT_DOMAIN, "bad property list"))); dgettext(TEXT_DOMAIN, "bad property list")));
} }
if ((entry = zfs_alloc(hdl, sizeof (zprop_list_t))) == NULL) entry = zfs_alloc(hdl, sizeof (zprop_list_t));
return (-1);
entry->pl_prop = prop; entry->pl_prop = prop;
if (prop == ZPROP_INVAL) { if (prop == ZPROP_INVAL) {
if ((entry->pl_user_prop = zfs_strdup(hdl, propname)) == entry->pl_user_prop = zfs_strdup(hdl, propname);
NULL) {
free(entry);
return (-1);
}
entry->pl_width = strlen(propname); entry->pl_width = strlen(propname);
} else { } else {
entry->pl_width = zprop_width(prop, &entry->pl_fixed, entry->pl_width = zprop_width(prop, &entry->pl_fixed,
@ -1951,9 +1945,7 @@ zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type)
* Add 'name' to the beginning of the list, which is handled * Add 'name' to the beginning of the list, which is handled
* specially. * specially.
*/ */
if ((entry = zfs_alloc(hdl, sizeof (zprop_list_t))) == NULL) entry = zfs_alloc(hdl, sizeof (zprop_list_t));
return (-1);
entry->pl_prop = ((type == ZFS_TYPE_POOL) ? ZPOOL_PROP_NAME : entry->pl_prop = ((type == ZFS_TYPE_POOL) ? ZPOOL_PROP_NAME :
((type == ZFS_TYPE_VDEV) ? VDEV_PROP_NAME : ZFS_PROP_NAME)); ((type == ZFS_TYPE_VDEV) ? VDEV_PROP_NAME : ZFS_PROP_NAME));
entry->pl_width = zprop_width(entry->pl_prop, entry->pl_width = zprop_width(entry->pl_prop,