aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic/tls-internal.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/tls-internal.c')
-rw-r--r--sysdeps/generic/tls-internal.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sysdeps/generic/tls-internal.c b/sysdeps/generic/tls-internal.c
index 898c20b..8a0f37d 100644
--- a/sysdeps/generic/tls-internal.c
+++ b/sysdeps/generic/tls-internal.c
@@ -16,6 +16,24 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <stdlib/arc4random.h>
+#include <string.h>
#include <tls-internal.h>
__thread struct tls_internal_t __tls_internal;
+
+void
+__glibc_tls_internal_free (void)
+{
+ free (__tls_internal.strsignal_buf);
+ free (__tls_internal.strerror_l_buf);
+
+ if (__tls_internal.rand_state != NULL)
+ {
+ /* Clear any lingering random state prior so if the thread stack is
+ cached it won't leak any data. */
+ explicit_bzero (__tls_internal.rand_state,
+ sizeof (*__tls_internal.rand_state));
+ free (__tls_internal.rand_state);
+ }
+}