From 3118efa3171ca1bd24dfd29ab7e0c494a6f93bf6 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Tue, 7 Sep 2021 22:54:47 +0800 Subject: [PATCH] sched/pidhash: init g_pidhash to NULL to avoid wild pointer Change-Id: Icbc70a850efb47eaaf942711430c72980c4bb95c Signed-off-by: chao.an --- sched/sched/sched_gettcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sched/sched/sched_gettcb.c b/sched/sched/sched_gettcb.c index 9b31aa2404d..daf48c259a1 100644 --- a/sched/sched/sched_gettcb.c +++ b/sched/sched/sched_gettcb.c @@ -74,7 +74,7 @@ FAR struct tcb_s *nxsched_get_tcb(pid_t pid) /* Verify that the correct TCB was found. */ - if (pid == g_pidhash[hash_ndx].pid) + if (g_pidhash && pid == g_pidhash[hash_ndx].pid) { /* Return the TCB associated with this pid (if any) */