Fix crash with multiple files
authorCarl Henrik Lunde <chlunde@ping.uio.no>
Mon, 20 Apr 2009 06:41:37 +0000 (08:41 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 20 Apr 2009 06:41:37 +0000 (08:41 +0200)
There's an off-by-one in add_file() when it calculates the size
for the file array.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c

index af23191fb33d9f78442ba24992024c332fa969bd..04d7b987085f00eb2e195e8a469d39adffede7b4 100644 (file)
@@ -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);