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


1541             zc->zc_iflags, &props))) {
1542                 nvlist_free(config);
1543                 return (error);
1544         }
1545 
1546         if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &guid) != 0 ||
1547             guid != zc->zc_guid)
1548                 error = SET_ERROR(EINVAL);
1549         else
1550                 error = spa_import(zc->zc_name, config, props, zc->zc_cookie);
1551 
1552         if (zc->zc_nvlist_dst != 0) {
1553                 int err;
1554 
1555                 if ((err = put_nvlist(zc, config)) != 0)
1556                         error = err;
1557         }
1558 
1559         nvlist_free(config);
1560 
1561         if (props)
1562                 nvlist_free(props);
1563 
1564         return (error);
1565 }
1566 
1567 static int
1568 zfs_ioc_pool_export(zfs_cmd_t *zc)
1569 {
1570         int error;
1571         boolean_t force = (boolean_t)zc->zc_cookie;
1572         boolean_t hardforce = (boolean_t)zc->zc_guid;
1573 
1574         zfs_log_history(zc);
1575         error = spa_export(zc->zc_name, NULL, force, hardforce);
1576         if (error == 0)
1577                 zvol_remove_minors(zc->zc_name);
1578         return (error);
1579 }
1580 
1581 static int




1541             zc->zc_iflags, &props))) {
1542                 nvlist_free(config);
1543                 return (error);
1544         }
1545 
1546         if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &guid) != 0 ||
1547             guid != zc->zc_guid)
1548                 error = SET_ERROR(EINVAL);
1549         else
1550                 error = spa_import(zc->zc_name, config, props, zc->zc_cookie);
1551 
1552         if (zc->zc_nvlist_dst != 0) {
1553                 int err;
1554 
1555                 if ((err = put_nvlist(zc, config)) != 0)
1556                         error = err;
1557         }
1558 
1559         nvlist_free(config);
1560 

1561         nvlist_free(props);
1562 
1563         return (error);
1564 }
1565 
1566 static int
1567 zfs_ioc_pool_export(zfs_cmd_t *zc)
1568 {
1569         int error;
1570         boolean_t force = (boolean_t)zc->zc_cookie;
1571         boolean_t hardforce = (boolean_t)zc->zc_guid;
1572 
1573         zfs_log_history(zc);
1574         error = spa_export(zc->zc_name, NULL, force, hardforce);
1575         if (error == 0)
1576                 zvol_remove_minors(zc->zc_name);
1577         return (error);
1578 }
1579 
1580 static int