From b19672ccc105ed3aa8357bb479590ea0cf62e54e Mon Sep 17 00:00:00 2001 From: zx568073531 <568073531@qq.com> Date: Sun, 25 Aug 2024 12:13:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DTLS=E5=86=85=E5=AD=98?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=B2=A1=E6=9C=89=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/posix/pthreads/pthread_tls.c | 4 +--- 1 file changed, 1 insertion(+), 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)