]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2140. [bug] libbind: missing unlock on pthread_key_create()
authorMark Andrews <marka@isc.org>
Sun, 25 Feb 2007 23:46:58 +0000 (23:46 +0000)
committerMark Andrews <marka@isc.org>
Sun, 25 Feb 2007 23:46:58 +0000 (23:46 +0000)
                        failures. [RT #16654]

CHANGES
lib/bind/irs/gai_strerror.c
lib/bind/irs/irs_data.c

diff --git a/CHANGES b/CHANGES
index dd8e95c2bc52fab57da60e9fe520e63771343bca..2cb620ebc339190a584ea6f66041c9042ebc8db9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2140.  [bug]           libbind: missing unlock on pthread_key_create()
+                       failures. [RT #16654]
+
 2139.  [bug]           dns_view_find() was being called with wrong type
                        in adb.c. [RT #16670]
 
index 29196a0a157db7b5de15face3cd687cd25beeb80..90e90cdd154a98103e9e5bfd0cd3ca7c88ae6472 100644 (file)
@@ -68,8 +68,10 @@ gai_strerror(int ecode) {
                 if (pthread_mutex_lock(&lock) != 0)
                        goto unknown;
                 if (!once) {
-                        if (pthread_key_create(&key, free) != 0)
+                        if (pthread_key_create(&key, free) != 0) {
+                               pthread_mutex_unlock(&lock);
                                goto unknown;
+                       }
                        once = 1;
                }
                 if (pthread_mutex_unlock(&lock) != 0)
index ca18394527a7e8325f4521a50bcef4b9dc96c70a..a3e776a60e7d6e8016d5501f5fcb94cbc0aa0efe 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: irs_data.c,v 1.10 2006/03/09 23:57:56 marka Exp $";
+static const char rcsid[] = "$Id: irs_data.c,v 1.11 2007/02/25 23:46:58 marka Exp $";
 #endif
 
 #include "port_before.h"
@@ -132,8 +132,10 @@ net_data_init(const char *conf_file) {
                if (pthread_mutex_lock(&keylock) != 0)
                        return (NULL);
                if (!once) {
-                       if (pthread_key_create(&key, net_data_destroy) != 0)
+                       if (pthread_key_create(&key, net_data_destroy) != 0) {
+                               pthread_mutex_unlock(&keylock);
                                return (NULL);
+                       }
                        once = 1;
                }
                if (pthread_mutex_unlock(&keylock) != 0)