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


 164         }
 165 
 166         dat.buf = strchr(buf, ']');
 167         dat.len -= (size_t)(dat.buf - buf);
 168 
 169         dat.buf[0] = '\r'; /* overwrite ']' with carriage return */
 170         dat.buf[1] = '\n'; /* overwrite ' ' with newline */
 171 
 172         if (syslog_cons && write(syslog_msgfd, dat.buf, dat.len) != dat.len) {
 173                 fmd_hdl_debug(hdl, "write failed: %s\n", strerror(errno));
 174                 syslog_stats.msg_err.fmds_value.ui64++;
 175         }
 176 }
 177 
 178 static void
 179 free_notify_prefs(fmd_hdl_t *hdl, nvlist_t **prefs, uint_t nprefs)
 180 {
 181         int i;
 182 
 183         for (i = 0; i < nprefs; i++) {
 184                 if (prefs[i])
 185                         nvlist_free(prefs[i]);
 186         }
 187 
 188         fmd_hdl_free(hdl, prefs, sizeof (nvlist_t *) * nprefs);
 189 }
 190 
 191 static int
 192 get_notify_prefs(fmd_hdl_t *hdl, nvlist_t *ev_nvl, nvlist_t ***pref_nvl,
 193     uint_t *nprefs)
 194 {
 195         nvlist_t *top_nvl, **np_nvlarr, *mech_nvl;
 196         nvlist_t **tmparr;
 197         int ret, i;
 198         uint_t nelem, nslelem;
 199 
 200         if ((ret = smf_notify_get_params(&top_nvl, ev_nvl)) != SCF_SUCCESS) {
 201                 ret = scf_error();
 202                 if (ret != SCF_ERROR_NOT_FOUND) {
 203                         fmd_hdl_debug(hdl, "Error looking up notification "
 204                             "preferences (%s)", scf_strerror(ret));




 164         }
 165 
 166         dat.buf = strchr(buf, ']');
 167         dat.len -= (size_t)(dat.buf - buf);
 168 
 169         dat.buf[0] = '\r'; /* overwrite ']' with carriage return */
 170         dat.buf[1] = '\n'; /* overwrite ' ' with newline */
 171 
 172         if (syslog_cons && write(syslog_msgfd, dat.buf, dat.len) != dat.len) {
 173                 fmd_hdl_debug(hdl, "write failed: %s\n", strerror(errno));
 174                 syslog_stats.msg_err.fmds_value.ui64++;
 175         }
 176 }
 177 
 178 static void
 179 free_notify_prefs(fmd_hdl_t *hdl, nvlist_t **prefs, uint_t nprefs)
 180 {
 181         int i;
 182 
 183         for (i = 0; i < nprefs; i++) {

 184                 nvlist_free(prefs[i]);
 185         }
 186 
 187         fmd_hdl_free(hdl, prefs, sizeof (nvlist_t *) * nprefs);
 188 }
 189 
 190 static int
 191 get_notify_prefs(fmd_hdl_t *hdl, nvlist_t *ev_nvl, nvlist_t ***pref_nvl,
 192     uint_t *nprefs)
 193 {
 194         nvlist_t *top_nvl, **np_nvlarr, *mech_nvl;
 195         nvlist_t **tmparr;
 196         int ret, i;
 197         uint_t nelem, nslelem;
 198 
 199         if ((ret = smf_notify_get_params(&top_nvl, ev_nvl)) != SCF_SUCCESS) {
 200                 ret = scf_error();
 201                 if (ret != SCF_ERROR_NOT_FOUND) {
 202                         fmd_hdl_debug(hdl, "Error looking up notification "
 203                             "preferences (%s)", scf_strerror(ret));