summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
authorzx568073531 <[email protected]>2024-08-25 12:13:34 +0800
committerMeco Man <[email protected]>2024-08-25 01:36:31 -0400
commitb19672ccc105ed3aa8357bb479590ea0cf62e54e (patch)
tree7132ab5111d7320aad0f49d212ce709426fc9323 /components/libc
parentf7f0afe03ebec007fda4e85100a8ca71a78ef831 (diff)
修复TLS内存申请没有初始化问题
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/posix/pthreads/pthread_tls.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/components/libc/posix/pthreads/pthread_tls.c b/components/libc/posix/pthreads/pthread_tls.c
index dc23cb763c..c14f3630ed 100644
--- a/components/libc/posix/pthreads/pthread_tls.c
+++ b/components/libc/posix/pthreads/pthread_tls.c
@@ -54,9 +54,7 @@ int pthread_setspecific(pthread_key_t key, const void *value)
/* check tls area */
if (ptd->tls == NULL)
{
- ptd->tls = (void**)rt_malloc(sizeof(void*) * PTHREAD_KEY_MAX);
-
- rt_memset(ptd->tls, 0, sizeof(void*) * PTHREAD_KEY_MAX);
+ ptd->tls = (void**)rt_calloc(PTHREAD_KEY_MAX, sizeof(void*));
}
if ((key < PTHREAD_KEY_MAX) && _thread_keys[key].is_used)