summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2015-02-03 06:04:16 +0000
committermarkj <markj@FreeBSD.org>2015-02-03 06:04:16 +0000
commit602435445df37a2b82ffd1590041ef06151ed22a (patch)
tree8bd84341b8976df3b0fef076763c0c3219eebe0c /sys/cddl
parentc436419aea65316658f955ab339fb1d6446b04fb (diff)
downloadFreeBSD-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.c17
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);
OpenPOWER on IntegriCloud