From f7f0afe03ebec007fda4e85100a8ca71a78ef831 Mon Sep 17 00:00:00 2001 From: SeliverWang <568073531@qq.com> Date: Sun, 25 Aug 2024 10:18:57 +0800 Subject: 修复TLS申请内存后没有初始化问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/posix/pthreads/pthread_tls.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'components') 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) -- cgit v1.3.1