From 2356fad02948cd7e19241609576b4378097b9e5d Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Sat, 23 Sep 2023 18:15:35 +0100 Subject: [PATCH] scheduler: use calloc instead of malloc (#7962) 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;