Author: markj Date: Tue Feb 3 06:04:16 2015 New Revision: 278137 URL: https://svnweb.freebsd.org/changeset/base/278137
Log: Continue to handle the case where state is NULL, though this currently cannot happen on FreeBSD. r278136 overlooked the fact that a destructor registered with devfs_set_cdevpriv(9) is invoked even in the case of an error. X-MFC-With: r278136 Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Feb 3 05:38:52 2015 (r278136) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Feb 3 06:04:16 2015 (r278137) @@ -14174,7 +14174,7 @@ dtrace_state_create(struct cdev *dev) if (dev != NULL) { cr = dev->si_cred; m = dev2unit(dev); - } + } /* Allocate memory for the state. */ state = kmem_zalloc(sizeof(dtrace_state_t), KM_SLEEP); @@ -16841,7 +16841,12 @@ dtrace_dtr(void *data) mutex_enter(&cpu_lock); mutex_enter(&dtrace_lock); - if (state->dts_anon) { +#ifdef illumos + if (state->dts_anon) +#else + if (state != NULL && state->dts_anon) +#endif + { /* * There is anonymous state. Destroy that first. */ @@ -16849,9 +16854,13 @@ dtrace_dtr(void *data) dtrace_state_destroy(state->dts_anon); } +#ifdef illumos dtrace_state_destroy(state); -#ifndef illumos - kmem_free(state, 0); +#else + if (state == NULL) { + dtrace_state_destroy(state); + kmem_free(state, 0); + } #endif ASSERT(dtrace_opens > 0); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"