From 6203763e2079901c3eae1ebd9e094d6a2afca996 Mon Sep 17 00:00:00 2001 From: Denis Pronin Date: Fri, 11 Mar 2022 15:13:46 +0300 Subject: [PATCH] fixed possible and actual memory leaks backend.c: release memory occupied by the parent process for options ioengines.c: free_ioengine entry point is protected by 'assert' call upon td and td->io_ops Signed-off-by: Denis Pronin --- backend.c | 3 +++ ioengines.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/backend.c b/backend.c index 001b2b96..317e4f6c 100644 --- a/backend.c +++ b/backend.c @@ -2433,8 +2433,10 @@ reap: } else { pid_t pid; struct fio_file **files; + void *eo; dprint(FD_PROCESS, "will fork\n"); files = td->files; + eo = td->eo; read_barrier(); pid = fork(); if (!pid) { @@ -2447,6 +2449,7 @@ reap: // freeing previously allocated memory for files // this memory freed MUST NOT be shared between processes, only the pointer itself may be shared within TD free(files); + free(eo); free(fd); fd = NULL; } diff --git a/ioengines.c b/ioengines.c index d08a511a..68f307e5 100644 --- a/ioengines.c +++ b/ioengines.c @@ -223,6 +223,8 @@ struct ioengine_ops *load_ioengine(struct thread_data *td) */ void free_ioengine(struct thread_data *td) { + assert(td != NULL && td->io_ops != NULL); + dprint(FD_IO, "free ioengine %s\n", td->io_ops->name); if (td->eo && td->io_ops->options) { -- 2.25.1