From 13741c9017bc2884f31c41db18405be271f20d70 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 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 776927dd4a8..373e21828fa 100644 --- a/sched/sched/sched_gettcb.c +++ b/sched/sched/sched_gettcb.c @@ -76,7 +76,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) */