---
htl/pt-exit.c | 4 ++++
include/libc-internal.h | 6 +-----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/htl/pt-exit.c b/htl/pt-exit.c
index 9d331d0d81..db6d560b36 100644
--- a/htl/pt-exit.c
+++ b/htl/pt-exit.c
@@ -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
diff --git a/include/libc-internal.h b/include/libc-internal.h
index 91ff0de1d7..e9f7bec5bf 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -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;
--
2.51.0