From 89bd6ab74a5c86bd4e3efbe97f9cb8fac545a95a Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 6 Mar 2024 17:00:22 +0800 Subject: [PATCH] sched/pthread: fix memory leak of pthread_tcb_s pthread tcb should be released appropriately Signed-off-by: chao an --- sched/pthread/pthread_create.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 87452cdc3af..8728e8d90a3 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -216,6 +216,8 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread, return ENOMEM; } + ptcb->cmn.flags |= TCB_FLAG_FREE_TCB; + /* Bind the parent's group to the new TCB (we have not yet joined the * group). */