if (f->fd != -1) {
if (td->unlink && td->filetype == FIO_TYPE_FILE)
unlink(f->file_name);
+ free(f->file_name);
+ f->file_name = NULL;
close(f->fd);
f->fd = -1;
}
f->mmap = NULL;
}
}
+
+ free(td->files);
+ td->files = NULL;
+ td->nr_files = 0;
}
if (init_random_state(td))
goto err;
- if (td->ioscheduler && switch_ioscheduler(td))
- goto err;
+ if (td->ioscheduler) {
+ int ret = switch_ioscheduler(td);
+
+ free(td->ioscheduler);
+ if (ret)
+ goto err;
+ }
td_set_runstate(td, TD_INITIALIZED);
fio_sem_up(&startup_sem);
gettimeofday(&td->epoch, NULL);
- if (td->exec_prerun)
+ if (td->exec_prerun) {
system(td->exec_prerun);
+ free(td->exec_prerun);
+ }
while (td->loops--) {
getrusage(RUSAGE_SELF, &td->ru_start);
finish_log(td, td->clat_log, "clat");
if (td->write_iolog)
write_iolog_close(td);
- if (td->exec_postrun)
+ if (td->exec_postrun) {
system(td->exec_postrun);
+ free(td->exec_postrun);
+ }
if (exitall_on_terminate)
terminate_threads(td->groupid);
int init_iolog(struct thread_data *td)
{
+ int ret = 0;
+
if (td->read_iolog)
- return init_iolog_read(td);
+ ret = init_iolog_read(td);
else if (td->write_iolog)
- return init_iolog_write(td);
+ ret = init_iolog_write(td);
+ free(td->iolog_file);
+ td->iolog_file = NULL;
return 0;
}
static void show_disk_util(void)
{
struct disk_util_stat *dus;
- struct list_head *entry;
+ struct list_head *entry, *next;
struct disk_util *du;
double util;
fprintf(f_out, " %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, in_queue=%u, util=%3.2f%%\n", du->name, dus->ios[0], dus->ios[1], dus->merges[0], dus->merges[1], dus->ticks[0], dus->ticks[1], dus->time_in_queue, util);
}
+
+ /*
+ * now free the list
+ */
+ list_for_each_safe(entry, next, &disk_list) {
+ list_del(entry);
+ du = list_entry(entry, struct disk_util, list);
+ free(du->name);
+ free(du);
+ }
}
static void show_ddir_status(struct thread_data *td, struct group_run_stats *rs,