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


 417 
 418         if (ruleset == NULL)
 419                 ruleset = FMEV_RULESET_DEFAULT;
 420 
 421         /*
 422          * We abuse the GPEC publication arguments as follows:
 423          *
 424          * GPEC argument        Our usage
 425          * -------------------- -----------------
 426          * const char *class    Raw class
 427          * const char *subclass Raw subclass
 428          * const char *vendor   Ruleset name
 429          * const char *pub_name Unused
 430          * nvlist_t *attr_list  Event attributes
 431          */
 432         rc = (sysevent_evc_publish(evc, class, subclass, ruleset, "",
 433             pub, EVCH_NOSLEEP) == 0) ? FMEV_SUCCESS : FMEVERR_TRANSPORT;
 434 
 435 done:
 436         /* Free a passed in nvlist iff success */
 437         if (nvl && rc == FMEV_SUCCESS)
 438                 nvlist_free(nvl);
 439 
 440         if (tmpnvl)
 441                 nvlist_free(tmpnvl);
 442 
 443         return (rc);
 444 }
 445 
 446 fmev_err_t
 447 _i_fmev_publish_nvl(
 448     const char *file, const char *func, int64_t line,
 449     const char *ruleset, const char *class, const char *subclass,
 450     fmev_pri_t pri, nvlist_t *attr)
 451 {
 452         fmev_err_t rc;
 453 
 454         if ((rc = vrfy(&ruleset, &class, &subclass, &pri)) != FMEV_OK)
 455                 return (rc);            /* any attr not freed */
 456 
 457         return (do_publish(file, func, line,
 458             ruleset, class, subclass,
 459             pri, attr, 0, NULL));       /* any attr freed iff success */
 460 }




 417 
 418         if (ruleset == NULL)
 419                 ruleset = FMEV_RULESET_DEFAULT;
 420 
 421         /*
 422          * We abuse the GPEC publication arguments as follows:
 423          *
 424          * GPEC argument        Our usage
 425          * -------------------- -----------------
 426          * const char *class    Raw class
 427          * const char *subclass Raw subclass
 428          * const char *vendor   Ruleset name
 429          * const char *pub_name Unused
 430          * nvlist_t *attr_list  Event attributes
 431          */
 432         rc = (sysevent_evc_publish(evc, class, subclass, ruleset, "",
 433             pub, EVCH_NOSLEEP) == 0) ? FMEV_SUCCESS : FMEVERR_TRANSPORT;
 434 
 435 done:
 436         /* Free a passed in nvlist iff success */
 437         if (rc == FMEV_SUCCESS)
 438                 nvlist_free(nvl);
 439 

 440         nvlist_free(tmpnvl);
 441 
 442         return (rc);
 443 }
 444 
 445 fmev_err_t
 446 _i_fmev_publish_nvl(
 447     const char *file, const char *func, int64_t line,
 448     const char *ruleset, const char *class, const char *subclass,
 449     fmev_pri_t pri, nvlist_t *attr)
 450 {
 451         fmev_err_t rc;
 452 
 453         if ((rc = vrfy(&ruleset, &class, &subclass, &pri)) != FMEV_OK)
 454                 return (rc);            /* any attr not freed */
 455 
 456         return (do_publish(file, func, line,
 457             ruleset, class, subclass,
 458             pri, attr, 0, NULL));       /* any attr freed iff success */
 459 }