From owner-svn-src-head@FreeBSD.ORG Tue Feb 3 06:04:17 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C01F584A; Tue, 3 Feb 2015 06:04:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB8C1632; Tue, 3 Feb 2015 06:04:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1364HeY043398; Tue, 3 Feb 2015 06:04:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1364HtO043396; Tue, 3 Feb 2015 06:04:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201502030604.t1364HtO043396@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 3 Feb 2015 06:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278137 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2015 06:04:17 -0000 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);