Print this page
6659 nvlist_free(NULL) is a no-op

@@ -1023,15 +1023,12 @@
  * Close the handle.  Simply frees the memory associated with the handle.
  */
 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);
         free(zhp);
 }
 
 /*

@@ -1546,11 +1543,10 @@
                 }
         }
 
         ret = zpool_import_props(hdl, config, newname, props,
             ZFS_IMPORT_NORMAL);
-        if (props)
                 nvlist_free(props);
         return (ret);
 }
 
 static void

@@ -2852,11 +2848,10 @@
 
         if (nvlist_lookup_nvlist_array(tree, ZPOOL_CONFIG_CHILDREN, &child,
             &children) != 0) {
                 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
                     "Source pool is missing vdev tree"));
-                if (zc_props)
                         nvlist_free(zc_props);
                 return (-1);
         }
 
         varray = zfs_alloc(hdl, children * sizeof (nvlist_t *));

@@ -3001,13 +2996,11 @@
                 for (v = 0; v < vcount; v++)
                         nvlist_free(varray[v]);
                 free(varray);
         }
         zcmd_free_nvlists(&zc);
-        if (zc_props)
                 nvlist_free(zc_props);
-        if (newconfig)
                 nvlist_free(newconfig);
         if (freelist) {
                 nvlist_free(*newroot);
                 *newroot = NULL;
         }