This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 89bd6ab74a sched/pthread: fix memory leak of pthread_tcb_s
89bd6ab74a is described below

commit 89bd6ab74a5c86bd4e3efbe97f9cb8fac545a95a
Author: chao an <[email protected]>
AuthorDate: Wed Mar 6 17:00:22 2024 +0800

    sched/pthread: fix memory leak of pthread_tcb_s
    
    pthread tcb should be released appropriately
    
    Signed-off-by: chao an <[email protected]>
---
 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 87452cdc3a..8728e8d90a 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).
    */

Reply via email to