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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/fm/topo/libtopo/common/sw.c
          +++ new/usr/src/lib/fm/topo/libtopo/common/sw.c
↓ open down ↓ 273 lines elided ↑ open up ↑
 274  274          /*
 275  275           * Add 'context' to the fmri.
 276  276           */
 277  277          if (err == 0)
 278  278                  err |= nvlist_add_nvlist(fmri, FM_FMRI_SW_CTXT, ctxt);
 279  279  
 280  280          moderr = err ? EMOD_NOMEM : 0;
 281  281  out:
 282  282          if (moderr == 0)
 283  283                  *out = fmri;
 284      -
 285      -        if (moderr != 0 && fmri)
      284 +        else
 286  285                  nvlist_free(fmri);
 287  286  
 288      -        if (obj)
 289      -                nvlist_free(obj);
 290      -
 291      -        if (site)
 292      -                nvlist_free(site);
 293      -
 294      -        if (ctxt)
 295      -                nvlist_free(ctxt);
      287 +        nvlist_free(obj);
      288 +        nvlist_free(site);
      289 +        nvlist_free(ctxt);
 296  290  
 297  291          return (moderr == 0 ? 0 : topo_mod_seterrno(mod, moderr));
 298  292  }
 299  293  
 300  294  
 301  295  /*ARGSUSED*/
 302  296  static int
 303  297  sw_enum(topo_mod_t *mod, tnode_t *pnode, const char *name,
 304  298      topo_instance_t min, topo_instance_t max, void *notused1, void *notused2)
 305  299  {
↓ open down ↓ 225 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX