Fix possible locking protocol failure in error handling path
authorKen Raeburn <raeburn@mit.edu>
Wed, 6 Aug 2008 00:01:37 +0000 (00:01 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 6 Aug 2008 00:01:37 +0000 (00:01 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20607 dc483132-0cff-0310-8789-dd5450dbe970

src/tests/gss-threads/gss-client.c
src/tests/gss-threads/gss-server.c

index f199dc252478360bea689bbb8e41e545d43f6be2..25c9d63ee691c6e3fd8fa4546dd37716548486e0 100644 (file)
@@ -20,7 +20,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 /*
- * Copyright (C) 2003, 2004 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2003, 2004, 2008 by the Massachusetts Institute of Technology.
  * All rights reserved.
  *
  * Export of this software from the United States of America may
@@ -703,6 +703,7 @@ WaitAndIncrementThreadCounter(void)
     if (counter == max_threads) {
        err = pthread_cond_wait(&counter_cond, &counter_mutex);
        if (err) {
+           pthread_mutex_unlock(&counter_mutex);
            perror("pthread_cond_wait");
            return 0;
        }
index 009c4f0863fdade3123482d256ed08bb7af4bfd4..bc22f83e5b4e2a690f6efa086904d01cb79d87b7 100644 (file)
@@ -20,7 +20,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 /*
- * Copyright (C) 2004 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2004,2008 by the Massachusetts Institute of Technology.
  * All rights reserved.
  *
  * Export of this software from the United States of America may
@@ -637,6 +637,7 @@ WaitAndIncrementThreadCounter(void)
     if (counter == max_threads) {
        err = pthread_cond_wait(&counter_cond, &counter_mutex);
        if (err) {
+           pthread_mutex_unlock(&counter_mutex);
            perror("pthread_cond_wait");
            return 0;
        }