about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_timedwait.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
index 3b29cb4ea6..d6a4ae7cfe 100644
--- a/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
@@ -46,7 +46,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
 {
   struct _pthread_cleanup_buffer buffer;
   struct _condvar_cleanup_buffer cbuffer;
-  int result = 0;
+  int result = 0, err;
 
   /* Catch invalid parameters.  */
   if (abstime->tv_nsec >= 1000000000)
@@ -56,7 +56,12 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   lll_mutex_lock (cond->__data.__lock);
 
   /* Now we can release the mutex.  */
-  __pthread_mutex_unlock_internal (mutex);
+  err = __pthread_mutex_unlock_internal (mutex);
+  if (err)
+    {
+      lll_mutex_unlock (cond->__data.__lock);
+      return err;
+    }
 
   /* We have one new user of the condvar.  */
   ++cond->__data.__total_seq;