From 4b341fca0dab0caa41d000e8db36f1530c26616f Mon Sep 17 00:00:00 2001 From: Carl Henrik Lunde Date: Mon, 20 Apr 2009 08:41:37 +0200 Subject: [PATCH] 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 --- filesetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.25.1