From aab83bb83be7342f6cfccaed8d5fe0b2f404855d Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Wed, 24 Feb 2016 11:58:55 -0500 Subject: 6659 nvlist_free(NULL) is a no-op Reviewed by: Toomas Soome Reviewed by: Marcel Telka Approved by: Robert Mustacchi --- usr/src/lib/libzfs/common/libzfs_pool.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'usr/src/lib/libzfs/common/libzfs_pool.c') diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c index 3c99295179..1f3ab8c3e9 100644 --- a/usr/src/lib/libzfs/common/libzfs_pool.c +++ b/usr/src/lib/libzfs/common/libzfs_pool.c @@ -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 @@ out: 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; -- cgit v1.2.3