From: Jens Axboe Date: Tue, 6 Jun 2006 08:06:42 +0000 (+0200) Subject: [PATCH] Cleanup allocation frees on exit X-Git-Tag: fio-1.5~45 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=4b5bd14ceeea40169a309c56c583ea0551cc12ed;p=fio.git [PATCH] Cleanup allocation frees on exit --- diff --git a/fio.c b/fio.c index bd938979..84c7d3e7 100644 --- a/fio.c +++ b/fio.c @@ -1282,6 +1282,22 @@ static int init_io_u(struct thread_data *td) return 0; } +static void cleanup_allocs(struct thread_data *td) +{ + if (td->directory) + free(td->directory); + if (td->iolog_file) + free(td->iolog_file); + if (td->exec_prerun) + free(td->exec_prerun); + if (td->exec_postrun) + free(td->exec_postrun); + if (td->ioscheduler) + free(td->ioscheduler); + if (td->sysfs_root) + free(td->sysfs_root); +} + static int create_file(struct thread_data *td, unsigned long long size, int extend) { @@ -1990,18 +2006,7 @@ err: } if (td->mmap) munmap(td->mmap, td->file_size); - if (td->directory) - free(td->directory); - if (td->iolog_file) - free(td->iolog_file); - if (td->exec_prerun) - free(td->exec_prerun); - if (td->exec_postrun) - free(td->exec_postrun); - if (td->ioscheduler) - free(td->ioscheduler); - if (td->sysfs_root) - free(td->sysfs_root); + cleanup_allocs(td); cleanup_io(td); cleanup_io_u(td); td_set_runstate(td, TD_EXITED);