about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nptl/pthread_create.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index bac7455af8..40a95c6f91 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -25,6 +25,7 @@
 #include <hp-timing.h>
 #include <ldsodefs.h>
 #include <atomic.h>
+#include <libc-internal.h>
 
 #include <shlib-compat.h>
 
@@ -227,6 +228,8 @@ start_thread (void *arg)
       pd->result = pd->start_routine (pd->arg);
     }
 
+  /* Clean up any state libc stored in thread-local variables.  */
+  __libc_thread_freeres ();
 
   /* If this is the last thread we terminate the process now.  We
      do not notify the debugger, it might just irritate it if there
@@ -235,7 +238,6 @@ start_thread (void *arg)
     /* This was the last thread.  */
     exit (0);
 
-
   /* Report the death of the thread if this is wanted.  */
   if (__builtin_expect (pd->report_events, 0))
     {