22 May
2026
22 May
'26
11:29 a.m.
From: Weili Qian <qianweili@huawei.com> strdup () may fail to allocate memory. Therefore, the return value needs to be checked, fix it. Signed-off-by: Weili Qian <qianweili@huawei.com> --- wd_util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wd_util.c b/wd_util.c index cf1baa0..043179f 100644 --- a/wd_util.c +++ b/wd_util.c @@ -306,6 +306,9 @@ int wd_init_sched(struct wd_sched *in, struct wd_sched *from) in->h_sched_ctx = from->h_sched_ctx; in->name = strdup(from->name); + if (!in->name) + return -WD_ENOMEM; + in->sched_init = from->sched_init; in->pick_next_ctx = from->pick_next_ctx; in->poll_policy = from->poll_policy; -- 2.43.0