]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: Also use __libc_thread_freeres to clean TLS state
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 22 Nov 2025 02:25:26 +0000 (02:25 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 22 Nov 2025 02:27:40 +0000 (03:27 +0100)
htl/pt-exit.c
include/libc-internal.h

index 9d331d0d81d21b9390d317d097a7681d68f5d5cd..db6d560b36dbb5fee2f427fe1524956f2ea6936b 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <atomic.h>
 #include <shlib-compat.h>
+#include <libc-internal.h>
 
 /* Terminate the current thread and make STATUS available to any
    thread that might join it.  */
@@ -49,6 +50,9 @@ __pthread_exit (void *status)
   /* Call destructors for the thread_local TLS variables.  */
   call_function_static_weak (__call_tls_dtors);
 
+  /* Clean up any state libc stored in thread-local variables.  */
+  __libc_thread_freeres ();
+
   __pthread_setcancelstate (oldstate, &oldstate);
 
   /* Decrease the number of threads.  We use an atomic operation to
index 91ff0de1d7f9ceebf9401a12b204e0560befd7ef..e9f7bec5bf246eaf90c4d43f8f3172544b17203b 100644 (file)
@@ -35,11 +35,7 @@ extern void __libc_freeres (void);
 libc_hidden_proto (__libc_freeres)
 
 /* Free resources stored in thread-local variables on thread exit.  */
-extern void __libc_thread_freeres (void)
-#if PTHREAD_IN_LIBC
-  attribute_hidden
-#endif
-  ;
+extern void __libc_thread_freeres (void) attribute_hidden;
 
 /* Define and initialize `__progname' et. al.  */
 extern void __init_misc (int, char **, char **) attribute_hidden;