From 4b5da010ac92c99dc455bacc2d60620236528f89 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 19 Aug 2020 12:10:26 -0600 Subject: [PATCH] init: add_job() needs to use right file freeing functions Signed-off-by: Jens Axboe --- init.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/init.c b/init.c index 6ff7c68d..3073c2a0 100644 --- a/init.c +++ b/init.c @@ -1736,9 +1736,17 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, if (td_new->files) { struct fio_file *f; for_each_file(td_new, f, i) { - if (f->file_name) - sfree(f->file_name); - sfree(f); + bool use_smalloc = fio_file_smalloc(f); + if (f->file_name) { + if (use_smalloc) + sfree(f->file_name); + else + free(f->file_name); + } + if (use_smalloc) + sfree(f); + else + free(f); } free(td_new->files); td_new->files = NULL; -- 2.25.1