From owner-svn-src-stable-7@FreeBSD.ORG Wed Jun 9 07:36:35 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7D5A106566B; Wed, 9 Jun 2010 07:36:35 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A58BB8FC0C; Wed, 9 Jun 2010 07:36:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o597aZpw052901; Wed, 9 Jun 2010 07:36:35 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o597aZUk052899; Wed, 9 Jun 2010 07:36:35 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201006090736.o597aZUk052899@svn.freebsd.org> From: Brian Somers Date: Wed, 9 Jun 2010 07:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208937 - stable/7/lib/libthr/thread X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2010 07:36:35 -0000 Author: brian Date: Wed Jun 9 07:36:35 2010 New Revision: 208937 URL: http://svn.freebsd.org/changeset/base/208937 Log: MFC r197477 - clean up keys deleted via pthread_key_delete() PR: 135462 Modified: stable/7/lib/libthr/thread/thr_spec.c Directory Properties: stable/7/lib/libthr/ (props changed) Modified: stable/7/lib/libthr/thread/thr_spec.c ============================================================================== --- stable/7/lib/libthr/thread/thr_spec.c Wed Jun 9 07:31:41 2010 (r208936) +++ stable/7/lib/libthr/thread/thr_spec.c Wed Jun 9 07:36:35 2010 (r208937) @@ -131,9 +131,19 @@ _thread_cleanupspecific(void) curthread->specific[key].data = NULL; curthread->specific_data_count--; } + else if (curthread->specific[key].data != NULL) { + /* + * This can happen if the key is deleted via + * pthread_key_delete without first setting the value + * to NULL in all threads. POSIX says that the + * destructor is not invoked in this case. + */ + curthread->specific[key].data = NULL; + curthread->specific_data_count--; + } /* - * If there is a destructore, call it + * If there is a destructor, call it * with the key table entry unlocked: */ if (destructor != NULL) {