From: Carl Henrik Lunde Date: Mon, 20 Apr 2009 06:41:37 +0000 (+0200) Subject: Fix crash with multiple files X-Git-Tag: fio-1.25.2~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=4b341fca0dab0caa41d000e8db36f1530c26616f Fix crash with multiple files There's an off-by-one in add_file() when it calculates the size for the file array. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index af23191f..04d7b987 100644 --- a/filesetup.c +++ b/filesetup.c @@ -686,7 +686,7 @@ int add_file(struct thread_data *td, const char *fname) f->fd = -1; if (td->files_size <= td->files_index) { - int new_size = td->o.nr_files; + int new_size = td->o.nr_files + 1; dprint(FD_FILE, "resize file array to %d files\n", new_size);