Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Aug 2012 19:27:13 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238979 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Message-ID:  <201208011927.q71JRDAu090380@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Wed Aug  1 19:27:12 2012
New Revision: 238979
URL: http://svn.freebsd.org/changeset/base/238979

Log:
  When we return with an error we cannot unlock the mutex, because
  it's been freed.  Protect against that, hopefully unlikely, case.
  
  Reviewed by:	rpaulo
  MFC after: 2 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c	Wed Aug  1 18:52:07 2012	(r238978)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c	Wed Aug  1 19:27:12 2012	(r238979)
@@ -942,7 +942,8 @@ dt_proc_create_thread(dtrace_hdl_t *dtp,
 		    (int)dpr->dpr_pid, strerror(err));
 	}
 
-	(void) pthread_mutex_unlock(&dpr->dpr_lock);
+	if (err == 0)
+		(void) pthread_mutex_unlock(&dpr->dpr_lock);
 	(void) pthread_attr_destroy(&a);
 
 	return (err);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208011927.q71JRDAu090380>