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


 690                 diskp = new_diskmon(dmap_nvl, indp, indrp, diskprops);
 691 
 692                 if (topo_node_label(node, &label, &err) == 0) {
 693                         diskp->location = dstrdup(label);
 694                         topo_hdl_strfree(thp, label);
 695                 } else
 696                         diskp->location = dstrdup("unknown location");
 697 
 698                 if (!conf_failure && diskp != NULL) {
 699                         /* Add this diskmon to the disk list */
 700                         cfgdata_add_diskmon(config_data, diskp);
 701                         if (nvlist_add_uint64(g_topo2diskmon, cstr,
 702                             (uint64_t)(uintptr_t)diskp) != 0) {
 703                                 log_msg(MM_TOPO,
 704                                     "Could not add pointer to nvlist "
 705                                     "for `%s'!\n", cstr);
 706                         }
 707                 } else if (diskp != NULL) {
 708                         diskmon_free(diskp);
 709                 } else {
 710                         if (dmap_nvl)
 711                                 nvlist_free(dmap_nvl);
 712                         if (indp)
 713                                 ind_free(indp);
 714                         if (indrp)
 715                                 indrule_free(indrp);
 716                         if (diskprops)
 717                                 nvlist_free(diskprops);
 718                 }
 719 
 720                 wdp->pfmri = cstr;
 721         }
 722 
 723 
 724         return (0);
 725 }
 726 
 727 /*ARGSUSED*/
 728 static int
 729 gather_topo_cfg(topo_hdl_t *thp, tnode_t *node, void *arg)
 730 {
 731         char *nodename = topo_node_name(node);
 732         if (strcmp(DISK, nodename) == 0)
 733                 return (topo_add_disk(thp, node, (walk_diskmon_t *)arg)
 734                     ? TOPO_WALK_ERR : TOPO_WALK_NEXT);
 735         else if (strcmp(BAY, nodename) == 0)
 736                 return (topo_add_bay(thp, node, (walk_diskmon_t *)arg)




 690                 diskp = new_diskmon(dmap_nvl, indp, indrp, diskprops);
 691 
 692                 if (topo_node_label(node, &label, &err) == 0) {
 693                         diskp->location = dstrdup(label);
 694                         topo_hdl_strfree(thp, label);
 695                 } else
 696                         diskp->location = dstrdup("unknown location");
 697 
 698                 if (!conf_failure && diskp != NULL) {
 699                         /* Add this diskmon to the disk list */
 700                         cfgdata_add_diskmon(config_data, diskp);
 701                         if (nvlist_add_uint64(g_topo2diskmon, cstr,
 702                             (uint64_t)(uintptr_t)diskp) != 0) {
 703                                 log_msg(MM_TOPO,
 704                                     "Could not add pointer to nvlist "
 705                                     "for `%s'!\n", cstr);
 706                         }
 707                 } else if (diskp != NULL) {
 708                         diskmon_free(diskp);
 709                 } else {

 710                         nvlist_free(dmap_nvl);
 711                         if (indp)
 712                                 ind_free(indp);
 713                         if (indrp)
 714                                 indrule_free(indrp);

 715                         nvlist_free(diskprops);
 716                 }
 717 
 718                 wdp->pfmri = cstr;
 719         }
 720 
 721 
 722         return (0);
 723 }
 724 
 725 /*ARGSUSED*/
 726 static int
 727 gather_topo_cfg(topo_hdl_t *thp, tnode_t *node, void *arg)
 728 {
 729         char *nodename = topo_node_name(node);
 730         if (strcmp(DISK, nodename) == 0)
 731                 return (topo_add_disk(thp, node, (walk_diskmon_t *)arg)
 732                     ? TOPO_WALK_ERR : TOPO_WALK_NEXT);
 733         else if (strcmp(BAY, nodename) == 0)
 734                 return (topo_add_bay(thp, node, (walk_diskmon_t *)arg)