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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fm/fmd/common/fmd_xprt.c
          +++ new/usr/src/cmd/fm/fmd/common/fmd_xprt.c
↓ open down ↓ 1150 lines elided ↑ open up ↑
1151 1151                          if (fru && topo_fmri_label(thp, fru, &loc, &err) == 0)
1152 1152                                  (void) nvlist_add_string(flt_copy,
1153 1153                                      FM_FAULT_LOCATION, loc);
1154 1154                          else if (rsrc && topo_fmri_label(thp, rsrc, &loc,
1155 1155                              &err) == 0)
1156 1156                                  (void) nvlist_add_string(flt_copy,
1157 1157                                      FM_FAULT_LOCATION, loc);
1158 1158                          if (loc)
1159 1159                                  topo_hdl_strfree(thp, loc);
1160 1160                  }
1161      -                if (fru)
1162      -                        nvlist_free(fru);
1163      -                if (asru)
1164      -                        nvlist_free(asru);
1165      -                if (rsrc)
1166      -                        nvlist_free(rsrc);
     1161 +                nvlist_free(fru);
     1162 +                nvlist_free(asru);
     1163 +                nvlist_free(rsrc);
1167 1164                  fmd_fmri_topo_rele(thp);
1168 1165                  fmd_case_insert_suspect(cp, flt_copy);
1169 1166          }
1170 1167  
1171 1168          /*
1172 1169           * copy diag_time if present
1173 1170           */
1174 1171          if (nvlist_lookup_int64_array(nvl, FM_SUSPECT_DIAG_TIME, &diag_time,
1175 1172              &nelem2) == 0 && nelem2 >= 2)
1176 1173                  fmd_case_settime(cp, diag_time[0], diag_time[1]);
↓ open down ↓ 143 lines elided ↑ open up ↑
1320 1317          }
1321 1318  
1322 1319          /*
1323 1320           * If we're set up only to report locally present hc-scheme
1324 1321           * faults, and there aren't any, then just drop the event.
1325 1322           */
1326 1323          if (got_present_rsrc == 0 &&
1327 1324              (xip->xi_flags & FMD_XPRT_HC_PRESENT_ONLY)) {
1328 1325                  if (nelem > 0) {
1329 1326                          for (i = 0; i < nelem; i++)
1330      -                                if (asrua[i])
1331      -                                        nvlist_free(asrua[i]);
     1327 +                                nvlist_free(asrua[i]);
1332 1328                          fmd_free(proxy_asru, sizeof (uint8_t) * nelem);
1333 1329                          fmd_free(diag_asru, sizeof (uint8_t) * nelem);
1334 1330                          fmd_free(asrua, sizeof (nvlist_t *) * nelem);
1335 1331                  }
1336 1332                  return;
1337 1333          }
1338 1334  
1339 1335          /*
1340 1336           * If fmd_case_recreate() returns NULL, UUID is already known.
1341 1337           */
1342 1338          fmd_module_lock(xip->xi_queue->eq_mod);
1343 1339          if ((cp = fmd_case_recreate(xip->xi_queue->eq_mod, xp,
1344 1340              FMD_CASE_UNSOLVED, uuid, code)) == NULL) {
1345 1341                  if (nelem > 0) {
1346 1342                          for (i = 0; i < nelem; i++)
1347      -                                if (asrua[i])
1348      -                                        nvlist_free(asrua[i]);
     1343 +                                nvlist_free(asrua[i]);
1349 1344                          fmd_free(proxy_asru, sizeof (uint8_t) * nelem);
1350 1345                          fmd_free(diag_asru, sizeof (uint8_t) * nelem);
1351 1346                          fmd_free(asrua, sizeof (nvlist_t *) * nelem);
1352 1347                  }
1353 1348                  fmd_module_unlock(xip->xi_queue->eq_mod);
1354 1349                  return;
1355 1350          }
1356 1351  
1357 1352          cip = (fmd_case_impl_t *)cp;
1358 1353          cip->ci_diag_asru = diag_asru;
↓ open down ↓ 664 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX