6659 nvlist_free(NULL) is a no-op

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Marcel Telka <marcel@telka.sk>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

illumos/illumos-gate@aab83bb83b
This commit is contained in:
Alexander Motin 2016-03-08 18:08:33 +00:00
parent 3549be1d06
commit 117b5ba78e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/illumos/dist/; revision=296527
12 changed files with 20 additions and 40 deletions

View File

@ -5327,8 +5327,7 @@ zfs_do_allow_unallow_impl(int argc, char **argv, boolean_t un)
cleanup0:
nvlist_free(perm_nvl);
if (update_perm_nvl != NULL)
nvlist_free(update_perm_nvl);
nvlist_free(update_perm_nvl);
cleanup1:
fs_perm_set_fini(&fs_perm_set);
cleanup2:

View File

@ -3267,8 +3267,7 @@ zpool_do_split(int argc, char **argv)
if (add_prop_list(
zpool_prop_to_name(ZPOOL_PROP_ALTROOT), optarg,
&props, B_TRUE) != 0) {
if (props)
nvlist_free(props);
nvlist_free(props);
usage(B_FALSE);
}
break;
@ -3281,8 +3280,7 @@ zpool_do_split(int argc, char **argv)
propval++;
if (add_prop_list(optarg, propval,
&props, B_TRUE) != 0) {
if (props)
nvlist_free(props);
nvlist_free(props);
usage(B_FALSE);
}
} else {

View File

@ -1400,8 +1400,7 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props,
}
if (zpool_vdev_split(zhp, newname, &newroot, props, flags) != 0) {
if (newroot != NULL)
nvlist_free(newroot);
nvlist_free(newroot);
return (NULL);
}

View File

@ -540,8 +540,7 @@ nvpair_free(nvpair_t *nvp)
int i;
for (i = 0; i < NVP_NELEM(nvp); i++)
if (nvlp[i] != NULL)
nvlist_free(nvlp[i]);
nvlist_free(nvlp[i]);
break;
}
default:

View File

@ -318,8 +318,7 @@ zpool_refresh_stats(zpool_handle_t *zhp, boolean_t *missing)
verify(nvlist_lookup_uint64(config,
ZPOOL_CONFIG_POOL_TXG, &newtxg) == 0);
if (zhp->zpool_old_config != NULL)
nvlist_free(zhp->zpool_old_config);
nvlist_free(zhp->zpool_old_config);
if (oldtxg != newtxg) {
nvlist_free(zhp->zpool_config);

View File

@ -2004,8 +2004,7 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
zcmd_free_nvlists(&zc);
return (-1);
}
if (zplprops)
nvlist_free(zplprops);
nvlist_free(zplprops);
zcmd_free_nvlists(&zc);
break;
@ -4236,8 +4235,7 @@ zfs_smb_acl_mgmt(libzfs_handle_t *hdl, char *dataset, char *path,
return (-1);
}
error = ioctl(hdl->libzfs_fd, ZFS_IOC_SMB_ACL, &zc);
if (nvlist)
nvlist_free(nvlist);
nvlist_free(nvlist);
return (error);
}

View File

@ -1282,8 +1282,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
venext = ve->ve_next;
for (ce = ve->ve_configs; ce != NULL; ce = cenext) {
cenext = ce->ce_next;
if (ce->ce_config)
nvlist_free(ce->ce_config);
nvlist_free(ce->ce_config);
free(ce);
}
free(ve);

View File

@ -1025,12 +1025,9 @@ zpool_open(libzfs_handle_t *hdl, const char *pool)
void
zpool_close(zpool_handle_t *zhp)
{
if (zhp->zpool_config)
nvlist_free(zhp->zpool_config);
if (zhp->zpool_old_config)
nvlist_free(zhp->zpool_old_config);
if (zhp->zpool_props)
nvlist_free(zhp->zpool_props);
nvlist_free(zhp->zpool_config);
nvlist_free(zhp->zpool_old_config);
nvlist_free(zhp->zpool_props);
free(zhp);
}
@ -1548,8 +1545,7 @@ zpool_import(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
ret = zpool_import_props(hdl, config, newname, props,
ZFS_IMPORT_NORMAL);
if (props)
nvlist_free(props);
nvlist_free(props);
return (ret);
}
@ -2854,8 +2850,7 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
&children) != 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"Source pool is missing vdev tree"));
if (zc_props)
nvlist_free(zc_props);
nvlist_free(zc_props);
return (-1);
}
@ -3003,10 +2998,8 @@ zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
free(varray);
}
zcmd_free_nvlists(&zc);
if (zc_props)
nvlist_free(zc_props);
if (newconfig)
nvlist_free(newconfig);
nvlist_free(zc_props);
nvlist_free(newconfig);
if (freelist) {
nvlist_free(*newroot);
*newroot = NULL;

View File

@ -2753,8 +2753,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
out:
fsavl_destroy(stream_avl);
if (stream_nv)
nvlist_free(stream_nv);
nvlist_free(stream_nv);
if (softerr)
error = -2;
if (anyerr)

View File

@ -6006,8 +6006,7 @@ spa_sync_config_object(spa_t *spa, dmu_tx_t *tx)
spa_config_exit(spa, SCL_STATE, FTAG);
if (spa->spa_config_syncing)
nvlist_free(spa->spa_config_syncing);
nvlist_free(spa->spa_config_syncing);
spa->spa_config_syncing = config;
spa_sync_nvlist(spa, spa->spa_config_object, config, tx);

View File

@ -344,8 +344,7 @@ void
spa_config_set(spa_t *spa, nvlist_t *config)
{
mutex_enter(&spa->spa_props_lock);
if (spa->spa_config != NULL)
nvlist_free(spa->spa_config);
nvlist_free(spa->spa_config);
spa->spa_config = config;
mutex_exit(&spa->spa_props_lock);
}

View File

@ -1558,8 +1558,7 @@ zfs_ioc_pool_import(zfs_cmd_t *zc)
nvlist_free(config);
if (props)
nvlist_free(props);
nvlist_free(props);
return (error);
}