From 95af4b35cf569079d37b0036b04d145b30fb038c Mon Sep 17 00:00:00 2001 From: Fotis Panagiotopoulos Date: Wed, 5 Apr 2023 00:40:04 +0300 Subject: [PATCH] Fixed improper access of g_pidhash. --- sched/task/task_setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index df0034e0fe..157d0def9d 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -83,6 +83,7 @@ static int nxtask_assign_pid(FAR struct tcb_s *tcb) FAR struct tcb_s **pidhash; pid_t next_pid; int hash_ndx; + void *temp; int i; /* NOTE: @@ -160,8 +161,9 @@ retry: /* Release resource for original g_pidhash, using new g_pidhash */ - kmm_free(g_pidhash); + temp = g_pidhash; g_pidhash = pidhash; + kmm_free(temp); /* Let's try every allowable pid again */