improvements in dup_files function
[fio.git] / filesetup.c
index 7c32d0af438a304fe3aef5a0fa61a95831e01b81..ab6c488bb750ed7c53a56214a69a9f8b100a7057 100644 (file)
@@ -2031,11 +2031,12 @@ void dup_files(struct thread_data *td, struct thread_data *org)
        if (!org->files)
                return;
 
-       td->files = malloc(org->files_index * sizeof(f));
+       td->files = calloc(org->files_index, sizeof(f));
 
        if (td->o.file_lock_mode != FILE_LOCK_NONE)
                td->file_locks = malloc(org->files_index);
 
+       assert(org->files_index >= org->o.nr_files);
        for_each_file(org, f, i) {
                struct fio_file *__f;