mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
sched/sched/sched_waitpid.c: Fix null pointer derefence on race without DEBUG_ASSERT.
This commit is contained in:
committed by
Gregory Nutt
parent
e2976c5b4e
commit
1c3d6ea24b
@@ -547,10 +547,13 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||
child = group_exitchild(rtcb->group);
|
||||
DEBUGASSERT(child != NULL);
|
||||
|
||||
/* Discard the child entry */
|
||||
/* Discard the child entry, if we have one */
|
||||
|
||||
(void)group_removechild(rtcb->group, child->ch_pid);
|
||||
group_freechild(child);
|
||||
if (child != NULL)
|
||||
{
|
||||
(void)group_removechild(rtcb->group, child->ch_pid);
|
||||
group_freechild(child);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_SCHED_CHILD_STATUS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user