about summary refs log tree commit diff
path: root/sysdeps/generic/dl-tls.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/dl-tls.c')
-rw-r--r--sysdeps/generic/dl-tls.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index a6428652cf..b92fecbe27 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -356,7 +356,13 @@ _dl_deallocate_tls (void *tcb, bool dealloc_tcb)
   free (dtv - 1);
 
   if (dealloc_tcb)
-    free (tcb);
+    {
+# if TLS_TCB_AT_TP
+      /* The TCB follows the TLS blocks.  Back up to free the whole block.  */
+      tcb -= GL(dl_tls_static_size) - TLS_TCB_SIZE;
+# endif
+      free (tcb);
+    }
 }