From 9eebd4b0f42d8a9aac93d3cf0fd0a4918b7011a7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 15 Sep 2017 13:04:25 -0600 Subject: [PATCH] sched/waitpid.c: Eliminate a warning detected by GCC 6 --- sched/sched/sched_waitpid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sched/sched/sched_waitpid.c b/sched/sched/sched_waitpid.c index b657dcec81..b60f6d526c 100644 --- a/sched/sched/sched_waitpid.c +++ b/sched/sched/sched_waitpid.c @@ -305,7 +305,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) FAR struct tcb_s *rtcb = this_task(); FAR struct tcb_s *ctcb; #ifdef CONFIG_SCHED_CHILD_STATUS - FAR struct child_status_s *child; + FAR struct child_status_s *child = NULL; bool retains; #endif FAR struct siginfo info; @@ -547,6 +547,8 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) #ifdef CONFIG_SCHED_CHILD_STATUS if (retains) { + DEBUGASSERT(child != NULL); + /* Discard the child entry */ (void)group_removechild(rtcb->group, child->ch_pid);