diff --git a/sched/group/group_leave.c b/sched/group/group_leave.c index b4bde70463f..fe452f27c4c 100644 --- a/sched/group/group_leave.c +++ b/sched/group/group_leave.c @@ -120,15 +120,15 @@ group_release(FAR struct task_group_s *group, uint8_t ttype) } #endif - /* Mark the group as deleted now */ - - group->tg_flags |= GROUP_FLAG_DELETED; - /* Then drop the group freeing the allocated memory */ #ifndef CONFIG_DISABLE_PTHREAD if (ttype == TCB_FLAG_TTYPE_PTHREAD) { + /* Mark the group as deleted now */ + + group->tg_flags |= GROUP_FLAG_DELETED; + group_drop(group); } #endif diff --git a/sched/sched/sched_releasetcb.c b/sched/sched/sched_releasetcb.c index 005ab604828..8c3d3128951 100644 --- a/sched/sched/sched_releasetcb.c +++ b/sched/sched/sched_releasetcb.c @@ -176,6 +176,10 @@ int nxsched_release_tcb(FAR struct tcb_s *tcb, uint8_t ttype) #endif ) { + /* Mark the group as deleted now */ + + ttcb->group.tg_flags |= GROUP_FLAG_DELETED; + return ret; } }