diff options
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> | 2016-02-24 11:58:55 -0500 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2016-02-27 08:52:10 -0800 |
commit | aab83bb83be7342f6cfccaed8d5fe0b2f404855d (patch) | |
tree | 548e8760643ee94860fb29486fbf965675c52a59 /usr/src/lib | |
parent | d643a855cbd8c4fb4fe966406fa05dff70673597 (diff) | |
download | illumos-joyent-aab83bb83be7342f6cfccaed8d5fe0b2f404855d.tar.gz |
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>
Diffstat (limited to 'usr/src/lib')
34 files changed, 79 insertions, 164 deletions
diff --git a/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c b/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c index b5689ccf35..6186f187e0 100644 --- a/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c +++ b/usr/src/lib/cfgadm_plugins/ib/common/cfga_ib.c @@ -1970,8 +1970,7 @@ cfga_list_ext(const char *ap_id, cfga_list_data_t **ap_id_list, int *nlistp, } S_FREE(snap_data); - if (nvl) - nvlist_free(nvl); + nvlist_free(nvl); /* * if a cmdline specified ap_id doesn't match the known list of ap_ids diff --git a/usr/src/lib/cfgadm_plugins/sbd/common/ap_rcm.c b/usr/src/lib/cfgadm_plugins/sbd/common/ap_rcm.c index 770784f16f..63afa50627 100644 --- a/usr/src/lib/cfgadm_plugins/sbd/common/ap_rcm.c +++ b/usr/src/lib/cfgadm_plugins/sbd/common/ap_rcm.c @@ -797,8 +797,7 @@ ap_rcm_cap_cpu(apd_t *a, rcmd_t *rcm, rcm_handle_t *hd, uint_t flags, } done: - if (nvl) - nvlist_free(nvl); + nvlist_free(nvl); s_free(oldcpuids); s_free(newcpuids); return (rv); diff --git a/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c b/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c index d3ac298a1c..928978fa17 100644 --- a/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c +++ b/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c @@ -74,10 +74,8 @@ static int cleanup_set_errno(fmd_agent_hdl_t *hdl, nvlist_t *innvl, nvlist_t *outnvl, int err) { - if (innvl != NULL) - nvlist_free(innvl); - if (outnvl != NULL) - nvlist_free(outnvl); + nvlist_free(innvl); + nvlist_free(outnvl); return (fmd_agent_seterrno(hdl, err)); } diff --git a/usr/src/lib/fm/libfmd_agent/i386/fmd_agent_i386.c b/usr/src/lib/fm/libfmd_agent/i386/fmd_agent_i386.c index cc25fccb5e..0c537352a0 100644 --- a/usr/src/lib/fm/libfmd_agent/i386/fmd_agent_i386.c +++ b/usr/src/lib/fm/libfmd_agent/i386/fmd_agent_i386.c @@ -36,10 +36,8 @@ static int cleanup_set_errno(fmd_agent_hdl_t *hdl, nvlist_t *innvl, nvlist_t *outnvl, int err) { - if (innvl != NULL) - nvlist_free(innvl); - if (outnvl != NULL) - nvlist_free(outnvl); + nvlist_free(innvl); + nvlist_free(outnvl); return (fmd_agent_seterrno(hdl, err)); } diff --git a/usr/src/lib/fm/libfmevent/common/fmev_publish.c b/usr/src/lib/fm/libfmevent/common/fmev_publish.c index f3dc01ed11..6b9f464550 100644 --- a/usr/src/lib/fm/libfmevent/common/fmev_publish.c +++ b/usr/src/lib/fm/libfmevent/common/fmev_publish.c @@ -434,11 +434,10 @@ do_publish(const char *file, const char *func, int64_t line, done: /* Free a passed in nvlist iff success */ - if (nvl && rc == FMEV_SUCCESS) + if (rc == FMEV_SUCCESS) nvlist_free(nvl); - if (tmpnvl) - nvlist_free(tmpnvl); + nvlist_free(tmpnvl); return (rc); } diff --git a/usr/src/lib/fm/topo/libtopo/common/hc.c b/usr/src/lib/fm/topo/libtopo/common/hc.c index 352c34c2f6..59b9866285 100644 --- a/usr/src/lib/fm/topo/libtopo/common/hc.c +++ b/usr/src/lib/fm/topo/libtopo/common/hc.c @@ -1036,8 +1036,7 @@ hc_fmri_str2nvl(topo_mod_t *mod, tnode_t *node, topo_version_t version, return (0); hcfmbail: - if (nf != NULL) - nvlist_free(nf); + nvlist_free(nf); for (i = 0; i < npairs; i++) nvlist_free(pa[i]); topo_mod_free(mod, pa, npairs * sizeof (nvlist_t *)); @@ -1177,8 +1176,7 @@ hc_fmri_create(topo_mod_t *mod, nvlist_t *pfmri, int version, const char *name, if (hcl != NULL) { for (i = 0; i < pelems + 1; ++i) { - if (hcl[i] != NULL) - nvlist_free(hcl[i]); + nvlist_free(hcl[i]); } topo_mod_free(mod, hcl, sizeof (nvlist_t *) * (pelems + 1)); } diff --git a/usr/src/lib/fm/topo/libtopo/common/sw.c b/usr/src/lib/fm/topo/libtopo/common/sw.c index c655627f52..ef221565af 100644 --- a/usr/src/lib/fm/topo/libtopo/common/sw.c +++ b/usr/src/lib/fm/topo/libtopo/common/sw.c @@ -281,18 +281,12 @@ context: out: if (moderr == 0) *out = fmri; - - if (moderr != 0 && fmri) + else nvlist_free(fmri); - if (obj) - nvlist_free(obj); - - if (site) - nvlist_free(site); - - if (ctxt) - nvlist_free(ctxt); + nvlist_free(obj); + nvlist_free(site); + nvlist_free(ctxt); return (moderr == 0 ? 0 : topo_mod_seterrno(mod, moderr)); } diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c b/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c index 33516d348f..c712cac908 100644 --- a/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c +++ b/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c @@ -74,8 +74,7 @@ static int set_error(topo_hdl_t *thp, int err, int *errp, char *method, nvlist_t *nvlp) { - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); topo_dprintf(thp, TOPO_DBG_ERR, "%s failed: %s\n", method, topo_strerror(err)); @@ -88,8 +87,7 @@ set_error(topo_hdl_t *thp, int err, int *errp, char *method, nvlist_t *nvlp) static nvlist_t * set_nverror(topo_hdl_t *thp, int err, int *errp, char *method, nvlist_t *nvlp) { - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); topo_dprintf(thp, TOPO_DBG_ERR, "%s failed: %s\n", method, topo_strerror(err)); @@ -593,8 +591,7 @@ int topo_fmri_setprop(topo_hdl_t *thp, nvlist_t *nvl, const char *pg, nvlist_free(in); /* no return values */ - if (out != NULL) - nvlist_free(out); + nvlist_free(out); if (rv) return (-1); diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_parse.c b/usr/src/lib/fm/topo/libtopo/common/topo_parse.c index 84658982d9..da10e0df55 100644 --- a/usr/src/lib/fm/topo/libtopo/common/topo_parse.c +++ b/usr/src/lib/fm/topo/libtopo/common/topo_parse.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <libxml/parser.h> #include <fm/libtopo.h> #include <topo_alloc.h> @@ -195,8 +193,7 @@ tf_pad_free(topo_mod_t *mp, tf_pad_t *p) return; if (p->tpad_pgs != NULL) { for (n = 0; n < p->tpad_pgcnt; n++) - if (p->tpad_pgs[n] != NULL) - nvlist_free(p->tpad_pgs[n]); + nvlist_free(p->tpad_pgs[n]); topo_mod_free(mp, p->tpad_pgs, p->tpad_pgcnt * sizeof (nvlist_t *)); } diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_prop.c b/usr/src/lib/fm/topo/libtopo/common/topo_prop.c index 411475aae8..63ff31279a 100644 --- a/usr/src/lib/fm/topo/libtopo/common/topo_prop.c +++ b/usr/src/lib/fm/topo/libtopo/common/topo_prop.c @@ -109,8 +109,7 @@ propval_get(topo_pgroup_t *pg, const char *pname) static int method_geterror(nvlist_t *nvl, int err, int *errp) { - if (nvl != NULL) - nvlist_free(nvl); + nvlist_free(nvl); *errp = err; @@ -165,8 +164,7 @@ prop_method_get(tnode_t *node, topo_propval_t *pv, topo_propmethod_t *pm, return (method_geterror(nvl, ETOPO_PROP_TYPE, err)); /* Release the last value and re-assign to the new value */ - if (pv->tp_val != NULL) - nvlist_free(pv->tp_val); + nvlist_free(pv->tp_val); pv->tp_val = nvl; return (0); @@ -855,8 +853,7 @@ register_methoderror(tnode_t *node, topo_propmethod_t *pm, int *errp, int l, if (pm != NULL) { if (pm->tpm_name != NULL) topo_hdl_strfree(thp, pm->tpm_name); - if (pm->tpm_args != NULL) - nvlist_free(pm->tpm_args); + nvlist_free(pm->tpm_args); topo_hdl_free(thp, pm, sizeof (topo_propmethod_t)); } @@ -1307,8 +1304,7 @@ propmethod_destroy(topo_hdl_t *thp, topo_propval_t *pv) if (pm != NULL) { if (pm->tpm_name != NULL) topo_hdl_strfree(thp, pm->tpm_name); - if (pm->tpm_args != NULL) - nvlist_free(pm->tpm_args); + nvlist_free(pm->tpm_args); topo_hdl_free(thp, pm, sizeof (topo_propmethod_t)); pv->tp_method = NULL; } @@ -1327,8 +1323,7 @@ topo_propval_destroy(topo_propval_t *pv) if (pv->tp_name != NULL) topo_hdl_strfree(thp, pv->tp_name); - if (pv->tp_val != NULL) - nvlist_free(pv->tp_val); + nvlist_free(pv->tp_val); propmethod_destroy(thp, pv); @@ -1403,8 +1398,7 @@ get_pgrp_seterror(tnode_t *node, nvlist_t *nvl, int *errp, int err) { topo_node_unlock(node); - if (nvl != NULL) - nvlist_free(nvl); + nvlist_free(nvl); *errp = err; @@ -1476,8 +1470,7 @@ get_all_seterror(tnode_t *node, nvlist_t *nvl, int *errp, int err) { topo_node_unlock(node); - if (nvl != NULL) - nvlist_free(nvl); + nvlist_free(nvl); *errp = err; diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_xml.c b/usr/src/lib/fm/topo/libtopo/common/topo_xml.c index f26d5f6ef9..bbac0d17f1 100644 --- a/usr/src/lib/fm/topo/libtopo/common/topo_xml.c +++ b/usr/src/lib/fm/topo/libtopo/common/topo_xml.c @@ -1012,8 +1012,7 @@ pmr_done: xmlFree(meth_name); if (prop_name) xmlFree(prop_name); - if (arg_nvl) - nvlist_free(arg_nvl); + nvlist_free(arg_nvl); return (ret); } @@ -1102,8 +1101,7 @@ pgroup_record(topo_mod_t *mp, xmlNodePtr pxn, tnode_t *tn, const char *rname, e |= nvlist_add_nvlist_array(pgnvl, INV_PGRP_ALLPROPS, apl, pcnt); for (ai = 0; ai < pcnt; ai++) - if (apl[ai] != NULL) - nvlist_free(apl[ai]); + nvlist_free(apl[ai]); topo_mod_free(mp, apl, pcnt * sizeof (nvlist_t *)); if (e != 0) { nvlist_free(pgnvl); diff --git a/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c b/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c index f929d65a90..bef0828f89 100644 --- a/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c +++ b/usr/src/lib/fm/topo/modules/SUNW,SPARC-Enterprise/ioboard/opl_hostbridge.c @@ -209,8 +209,7 @@ opl_rc_node_create(topo_mod_t *mp, tnode_t *parent, di_node_t dnode, int inst) TOPO_IO_MODULE, TOPO_PROP_IMMUTABLE, mod, &err) != 0) { topo_mod_dprintf(mp, "Failed to set MODULE property\n"); } - if (mod != NULL) - nvlist_free(mod); + nvlist_free(mod); /* This is a PCIEX Root Complex */ if (topo_prop_set_string(rcn, TOPO_PGROUP_PCI, TOPO_PCI_EXCAP, diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk_common.c b/usr/src/lib/fm/topo/modules/common/disk/disk_common.c index d55d6037fc..7d42f3ee60 100644 --- a/usr/src/lib/fm/topo/modules/common/disk/disk_common.c +++ b/usr/src/lib/fm/topo/modules/common/disk/disk_common.c @@ -266,12 +266,11 @@ disk_set_props(topo_mod_t *mod, tnode_t *parent, } err = 0; -out: if (fmri) - nvlist_free(fmri); +out: + nvlist_free(fmri); if (label) topo_mod_strfree(mod, label); - if (asru) - nvlist_free(asru); + nvlist_free(asru); return (err); error: err = topo_mod_seterrno(mod, err); diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c index 75008fd2fa..2fcc36e924 100644 --- a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c +++ b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c @@ -612,8 +612,7 @@ FRU_set(tnode_t *tn, did_t *pd, } nvlist_free(in); (void) topo_node_fru_set(tn, out, 0, &err); - if (out != NULL) - nvlist_free(out); + nvlist_free(out); } else (void) topo_node_fru_set(tn, NULL, 0, &err); diff --git a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c index 23052a2356..d9a8eca7b8 100644 --- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c @@ -688,8 +688,7 @@ amd_dramchan_create(topo_mod_t *mod, tnode_t *pnode, const char *name, (void) topo_prop_set_string(chnode, PGNAME(CHAN), "channel", TOPO_PROP_IMMUTABLE, i == 0 ? "A" : "B", &err); } - if (pfmri) - nvlist_free(pfmri); + nvlist_free(pfmri); return (nerr == 0 ? 0 : -1); } diff --git a/usr/src/lib/fm/topo/modules/sun4v/cpuboard/cpuboard_hostbridge.c b/usr/src/lib/fm/topo/modules/sun4v/cpuboard/cpuboard_hostbridge.c index 3ee979fcd0..15e685c1d4 100644 --- a/usr/src/lib/fm/topo/modules/sun4v/cpuboard/cpuboard_hostbridge.c +++ b/usr/src/lib/fm/topo/modules/sun4v/cpuboard/cpuboard_hostbridge.c @@ -184,8 +184,7 @@ cpuboard_rc_node_create(topo_mod_t *mp, tnode_t *parent, di_node_t dnode, TOPO_IO_MODULE, TOPO_PROP_IMMUTABLE, mod, &err) != 0) { topo_mod_dprintf(mp, "Failed to set MODULE property\n"); } - if (mod != NULL) - nvlist_free(mod); + nvlist_free(mod); /* This is a PCIEX Root Complex */ if (topo_prop_set_string(rcn, TOPO_PGROUP_PCI, TOPO_PCI_EXCAP, diff --git a/usr/src/lib/libbe/common/be_create.c b/usr/src/lib/libbe/common/be_create.c index f6a343829b..d06c9b02da 100644 --- a/usr/src/lib/libbe/common/be_create.c +++ b/usr/src/lib/libbe/common/be_create.c @@ -352,8 +352,7 @@ be_init(nvlist_t *be_attrs) } done: - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); be_zfs_fini(); @@ -1167,8 +1166,7 @@ done: ZFS_CLOSE(zhp); be_free_fs_list(&fld); - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); free(bt.obe_altroot); free(new_mp); @@ -2090,8 +2088,7 @@ be_copy_zones(char *obe_name, char *obe_root_ds, char *nbe_root_ds) "failed to create zone BE clone for new " "zone BE %s\n"), new_zone_be_name); ret = iret; - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); goto done; } /* @@ -2116,8 +2113,7 @@ be_copy_zones(char *obe_name, char *obe_root_ds, char *nbe_root_ds) "failed to generate auto name " "for zone BE.\n")); ret = BE_ERR_AUTONAME; - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); goto done; } @@ -2140,8 +2136,7 @@ be_copy_zones(char *obe_name, char *obe_root_ds, char *nbe_root_ds) zoneroot_ds, libzfs_error_description(g_zfs)); ret = zfs_err_to_be_err(g_zfs); - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); goto done; } @@ -2161,8 +2156,7 @@ be_copy_zones(char *obe_name, char *obe_root_ds, char *nbe_root_ds) "for new zone BE %s\n"), new_zone_be_name); ret = iret; - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); goto done; } } @@ -2177,14 +2171,12 @@ be_copy_zones(char *obe_name, char *obe_root_ds, char *nbe_root_ds) free(bt.nbe_name); bt.nbe_name = NULL; ret = BE_ERR_AUTONAME; - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); goto done; } } - if (bt.nbe_zfs_props != NULL) - nvlist_free(bt.nbe_zfs_props); + nvlist_free(bt.nbe_zfs_props); z_zhp = NULL; diff --git a/usr/src/lib/libbe/common/be_snapshot.c b/usr/src/lib/libbe/common/be_snapshot.c index d63528d05e..a4e2c79e5a 100644 --- a/usr/src/lib/libbe/common/be_snapshot.c +++ b/usr/src/lib/libbe/common/be_snapshot.c @@ -606,8 +606,7 @@ _be_create_snapshot(char *be_name, char **snap_name, char *policy) done: ZFS_CLOSE(zhp); - if (ss_props != NULL) - nvlist_free(ss_props); + nvlist_free(ss_props); return (ret); } diff --git a/usr/src/lib/libcmdutils/common/process_xattrs.c b/usr/src/lib/libcmdutils/common/process_xattrs.c index 1264d467bd..50b1de58d6 100644 --- a/usr/src/lib/libcmdutils/common/process_xattrs.c +++ b/usr/src/lib/libcmdutils/common/process_xattrs.c @@ -218,8 +218,7 @@ mv_xattrs(char *cmd, char *infile, char *outfile, int sattr, int silent) "failed to move system attribute"); } error: - if (res != NULL) - nvlist_free(res); + nvlist_free(res); if (silent == 0 && etext != NULL) { if (!sattr) (void) fprintf(stderr, dgettext(TEXT_DOMAIN, @@ -246,8 +245,7 @@ done: (void) close(indfd); if (outdfd != -1) (void) close(outdfd); - if (response != NULL) - nvlist_free(response); + nvlist_free(response); if (etext != NULL) return (1); else @@ -319,7 +317,6 @@ sysattr_list(char *cmd, int fd, char *fname) return (response); } } - if (response != NULL) - nvlist_free(response); + nvlist_free(response); return (NULL); } diff --git a/usr/src/lib/libcontract/common/libcontract.c b/usr/src/lib/libcontract/common/libcontract.c index 2c8afda094..3a3bf4a76a 100644 --- a/usr/src/lib/libcontract/common/libcontract.c +++ b/usr/src/lib/libcontract/common/libcontract.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/ctfs.h> #include <sys/contract.h> #include <string.h> @@ -467,8 +465,7 @@ errout: if (event_buffer) free(event_buffer); if (info) { - if (info->nvl) - nvlist_free(info->nvl); + nvlist_free(info->nvl); free(info); } return (error); @@ -507,8 +504,7 @@ ct_event_free(ct_evthdl_t evthdl) { struct ctlib_event_info *info = evthdl; - if (info->nvl) - nvlist_free(info->nvl); + nvlist_free(info->nvl); free(info); } diff --git a/usr/src/lib/libdiskmgt/common/entry.c b/usr/src/lib/libdiskmgt/common/entry.c index 6acf22f82a..94b36a55be 100644 --- a/usr/src/lib/libdiskmgt/common/entry.c +++ b/usr/src/lib/libdiskmgt/common/entry.c @@ -716,10 +716,8 @@ dm_isoverlapping(char *slicename, char **overlaps_with, int *errp) } out: - if (media_attrs) - nvlist_free(media_attrs); - if (slice_attrs) - nvlist_free(slice_attrs); + nvlist_free(media_attrs); + nvlist_free(slice_attrs); if (slices) dm_free_descriptors(slices); @@ -1057,8 +1055,7 @@ dm_inuse(char *dev_name, char **msg, dm_who_type_t who, int *errp) out: if (dname != NULL) free(dname); - if (dev_stats != NULL) - nvlist_free(dev_stats); + nvlist_free(dev_stats); return (found); } diff --git a/usr/src/lib/libdladm/common/libdllink.c b/usr/src/lib/libdladm/common/libdllink.c index 8a3c5759ee..58bec0ad30 100644 --- a/usr/src/lib/libdladm/common/libdllink.c +++ b/usr/src/lib/libdladm/common/libdllink.c @@ -580,8 +580,7 @@ i_dladm_rename_link_c2(dladm_handle_t handle, datalink_id_t linkid1, done: if (rcm_hdl != NULL) (void) rcm_free_handle(rcm_hdl); - if (nvl != NULL) - nvlist_free(nvl); + nvlist_free(nvl); return (status); } diff --git a/usr/src/lib/libipp/libipp.c b/usr/src/lib/libipp/libipp.c index 94a5dc3a45..0b931a10e8 100644 --- a/usr/src/lib/libipp/libipp.c +++ b/usr/src/lib/libipp/libipp.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <sys/types.h> @@ -225,8 +223,7 @@ ipp_action_destroy( return (dispatch(&nvlp, NULL, NULL)); failed: - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); errno = rc; return (-1); } @@ -336,8 +333,7 @@ ipp_action_info( return (dispatch(&nvlp, fn, arg)); failed: - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); errno = rc; return (-1); } @@ -389,8 +385,7 @@ ipp_action_mod( return (dispatch(&nvlp, string_callback, (void *)modnamep)); failed: - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); errno = rc; return (-1); } @@ -446,8 +441,7 @@ ipp_list_mods( return (rc); failed: - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); errno = rc; return (-1); } @@ -510,8 +504,7 @@ ipp_mod_list_actions( return (rc); failed: - if (nvlp != NULL) - nvlist_free(nvlp); + nvlist_free(nvlp); errno = rc; return (-1); } diff --git a/usr/src/lib/libnwam/common/libnwam_values.c b/usr/src/lib/libnwam/common/libnwam_values.c index 6c9d08a3ce..8bf78f62b9 100644 --- a/usr/src/lib/libnwam/common/libnwam_values.c +++ b/usr/src/lib/libnwam/common/libnwam_values.c @@ -380,8 +380,7 @@ nwam_alloc_object_list(void *list) void nwam_free_object_list(void *list) { - if (list != NULL) - nvlist_free(list); + nvlist_free(list); } nwam_error_t diff --git a/usr/src/lib/libpool/common/pool_kernel.c b/usr/src/lib/libpool/common/pool_kernel.c index 2e1375e499..2179a7f0ea 100644 --- a/usr/src/lib/libpool/common/pool_kernel.c +++ b/usr/src/lib/libpool/common/pool_kernel.c @@ -2415,8 +2415,7 @@ pool_knl_put_property(pool_elem_t *pe, const char *name, return (PO_FAIL); if (prov->pkc_log->l_state != LS_DO) { - if (bl) - nvlist_free(bl); + nvlist_free(bl); return (PO_SUCCESS); } /* @@ -3460,8 +3459,7 @@ log_item_release(log_item_t *li) case POOL_PROPPUT: propput = (pool_propput_undo_t *)li->li_details; - if (propput->ppu_blist) - nvlist_free(propput->ppu_blist); + nvlist_free(propput->ppu_blist); free(propput->ppu_ioctl.pp_o_buf); free(propput); break; diff --git a/usr/src/lib/librcm/librcm.c b/usr/src/lib/librcm/librcm.c index 88ca8b29c6..d3f7666495 100644 --- a/usr/src/lib/librcm/librcm.c +++ b/usr/src/lib/librcm/librcm.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "librcm_impl.h" #include "librcm_event.h" @@ -545,8 +543,7 @@ rcm_free_info(rcm_info_t *info) while (info) { rcm_info_t *tmp = info->next; - if (info->info) - nvlist_free(info->info); + nvlist_free(info->info); free(info); info = tmp; @@ -1260,8 +1257,7 @@ retry: out: if (nvl_packed) free(nvl_packed); - if (ret) - nvlist_free(ret); + nvlist_free(ret); dprintf((stderr, "daemon call is done. error = %d, errno = %s\n", error, strerror(errno))); return (error); @@ -1450,8 +1446,7 @@ rcm_generate_nvlist(int cmd, rcm_handle_t *hd, char **rsrcnames, uint_t flag, fail: if (buf) free(buf); - if (nvl) - nvlist_free(nvl); + nvlist_free(nvl); if (*nvl_packed) free(*nvl_packed); *nvl_packed = NULL; diff --git a/usr/src/lib/libscf/common/notify_params.c b/usr/src/lib/libscf/common/notify_params.c index 3e41d19f8f..963916514d 100644 --- a/usr/src/lib/libscf/common/notify_params.c +++ b/usr/src/lib/libscf/common/notify_params.c @@ -1770,8 +1770,7 @@ _scf_get_fma_notify_params(const char *class, nvlist_t *nvl, int getsource) r = SCF_SUCCESS; cleanup: - if (params) - nvlist_free(params); + nvlist_free(params); scf_pg_destroy(pg); scf_instance_destroy(i); scf_handle_destroy(h); diff --git a/usr/src/lib/libsysevent/libsysevent.c b/usr/src/lib/libsysevent/libsysevent.c index 28fdc6ca50..72ec9b008b 100644 --- a/usr/src/lib/libsysevent/libsysevent.c +++ b/usr/src/lib/libsysevent/libsysevent.c @@ -218,8 +218,7 @@ sysevent_free(sysevent_t *ev) { nvlist_t *attr_list = (nvlist_t *)(uintptr_t)SE_ATTR_PTR(ev); - if (attr_list) - nvlist_free(attr_list); + nvlist_free(attr_list); free(ev); } @@ -1462,8 +1461,7 @@ create_cached_registration(sysevent_handle_t *shp, create_failed: dealloc_subscribers(shp); free_cached_registration(shp); - if (nvl) - nvlist_free(nvl); + nvlist_free(nvl); return (-1); } diff --git a/usr/src/lib/libzfs/common/libzfs_config.c b/usr/src/lib/libzfs/common/libzfs_config.c index fe380a24a2..b33d86432d 100644 --- a/usr/src/lib/libzfs/common/libzfs_config.c +++ b/usr/src/lib/libzfs/common/libzfs_config.c @@ -319,8 +319,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); diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c index 9fa99749ce..71a2226fef 100644 --- a/usr/src/lib/libzfs/common/libzfs_dataset.c +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c @@ -2010,8 +2010,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; @@ -4251,8 +4250,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); } diff --git a/usr/src/lib/libzfs/common/libzfs_import.c b/usr/src/lib/libzfs/common/libzfs_import.c index 011861f548..032cd11c8c 100644 --- a/usr/src/lib/libzfs/common/libzfs_import.c +++ b/usr/src/lib/libzfs/common/libzfs_import.c @@ -1282,8 +1282,7 @@ error: 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); 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; diff --git a/usr/src/lib/libzfs/common/libzfs_sendrecv.c b/usr/src/lib/libzfs/common/libzfs_sendrecv.c index ef659ff000..456ad3b858 100644 --- a/usr/src/lib/libzfs/common/libzfs_sendrecv.c +++ b/usr/src/lib/libzfs/common/libzfs_sendrecv.c @@ -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) diff --git a/usr/src/lib/pylibbe/common/libbe_py.c b/usr/src/lib/pylibbe/common/libbe_py.c index bd9b3187ed..9cc1a7ac81 100644 --- a/usr/src/lib/pylibbe/common/libbe_py.c +++ b/usr/src/lib/pylibbe/common/libbe_py.c @@ -222,7 +222,7 @@ beCopy(PyObject *self, PyObject *args) NULL, NULL)); } - if (beProps != NULL) nvlist_free(beProps); + nvlist_free(beProps); if (trgtBeName == NULL) { /* |