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

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

diff --git a/CHANGES b/CHANGES
index 3cf96cae4f55739116f464a1e1a04b99e80a8009..64e6ae23a110485f38cd4c68d0ffd62e464964be 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 0492f8f49aa8d9a9a1c1c873223a89509ccf53cd..06eeeb36a3f8cdc7da5ee270418ddea5a6bd29a8 100644 (file)
@@ -69,8 +69,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 e65e62581dda4b912d52d1409ded18fe8b497261..47963f1e645d751b7d43e86b93e6bd2c46679e84 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.6 2006/03/10 00:18:22 marka Exp $";
+static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.7 2007/02/26 00:05:23 marka Exp $";
 #endif
 
 #include "port_before.h"
@@ -131,8 +131,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)