diff options
author | markj <markj@FreeBSD.org> | 2015-02-03 06:04:16 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2015-02-03 06:04:16 +0000 |
commit | 602435445df37a2b82ffd1590041ef06151ed22a (patch) | |
tree | 8bd84341b8976df3b0fef076763c0c3219eebe0c /sys/cddl | |
parent | c436419aea65316658f955ab339fb1d6446b04fb (diff) | |
download | FreeBSD-src-602435445df37a2b82ffd1590041ef06151ed22a.zip FreeBSD-src-602435445df37a2b82ffd1590041ef06151ed22a.tar.gz |
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
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 4251366..ffd0ef5 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -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); |