From a225804575acc19ff306436624d3002a1eadbb61 Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Fri, 22 Sep 2023 23:26:51 +0100 Subject: [PATCH] scheduler: use calloc instead of malloc This is fixing a use-after-free if multiple schedulers are used in a single run. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60089 Signed-off-by: David Korczynski --- src/flb_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flb_scheduler.c b/src/flb_scheduler.c index 597f6f5776e..91f70682822 100644 --- a/src/flb_scheduler.c +++ b/src/flb_scheduler.c @@ -523,7 +523,7 @@ struct flb_sched *flb_sched_create(struct flb_config *config, struct flb_sched *sched; struct flb_sched_timer *timer; - sched = flb_malloc(sizeof(struct flb_sched)); + sched = flb_calloc(1, sizeof(struct flb_sched)); if (!sched) { flb_errno(); return NULL;