summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
authorSeliverWang <[email protected]>2024-08-25 10:18:57 +0800
committerMeco Man <[email protected]>2024-08-25 01:36:31 -0400
commitf7f0afe03ebec007fda4e85100a8ca71a78ef831 (patch)
tree18562ab396bc94f2765ba08d464d90de753264e8 /components/libc
parent564ca848f428f7be6aa2372ff8666c1d7883e1b5 (diff)
修复TLS申请内存后没有初始化问题
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/posix/pthreads/pthread_tls.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/components/libc/posix/pthreads/pthread_tls.c b/components/libc/posix/pthreads/pthread_tls.c
index 2e709acb60..dc23cb763c 100644
--- a/components/libc/posix/pthreads/pthread_tls.c
+++ b/components/libc/posix/pthreads/pthread_tls.c
@@ -55,6 +55,8 @@ int pthread_setspecific(pthread_key_t key, const void *value)
if (ptd->tls == NULL)
{
ptd->tls = (void**)rt_malloc(sizeof(void*) * PTHREAD_KEY_MAX);
+
+ rt_memset(ptd->tls, 0, sizeof(void*) * PTHREAD_KEY_MAX);
}
if ((key < PTHREAD_KEY_MAX) && _thread_keys[key].is_used)