mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 04:07:45 +03:00
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:
@@ -73,23 +73,15 @@ refresh_config(libzfs_handle_t *hdl, nvlist_t *config)
|
||||
zfs_cmd_t zc = {"\0"};
|
||||
int err, dstbuf_size;
|
||||
|
||||
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0)
|
||||
return (NULL);
|
||||
zcmd_write_conf_nvlist(hdl, &zc, config);
|
||||
|
||||
dstbuf_size = MAX(CONFIG_BUF_MINSIZE, zc.zc_nvlist_conf_size * 32);
|
||||
|
||||
if (zcmd_alloc_dst_nvlist(hdl, &zc, dstbuf_size) != 0) {
|
||||
zcmd_free_nvlists(&zc);
|
||||
return (NULL);
|
||||
}
|
||||
zcmd_alloc_dst_nvlist(hdl, &zc, dstbuf_size);
|
||||
|
||||
while ((err = zfs_ioctl(hdl, ZFS_IOC_POOL_TRYIMPORT,
|
||||
&zc)) != 0 && errno == ENOMEM) {
|
||||
if (zcmd_expand_dst_nvlist(hdl, &zc) != 0) {
|
||||
zcmd_free_nvlists(&zc);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
&zc)) != 0 && errno == ENOMEM)
|
||||
zcmd_expand_dst_nvlist(hdl, &zc);
|
||||
|
||||
if (err) {
|
||||
zcmd_free_nvlists(&zc);
|
||||
@@ -442,12 +434,7 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
|
||||
|
||||
|
||||
if (ret) {
|
||||
if ((*namestr = zfs_strdup(hdl, name)) == NULL) {
|
||||
if (cb.cb_zhp)
|
||||
zpool_close(cb.cb_zhp);
|
||||
nvlist_free(config);
|
||||
return (-1);
|
||||
}
|
||||
*namestr = zfs_strdup(hdl, name);
|
||||
*state = (pool_state_t)stateval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user