X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=filesetup.c;h=5e8ea357deb82a308d1102f888d895171cfc9e3c;hp=c4240d2a8c9bb457ee2c92c9d5a3375a27885795;hb=d33db728d79386d544be93c24f4e3383f2a47143;hpb=97bb54c9606c6a84a6d779d89258b67a65f87047 diff --git a/filesetup.c b/filesetup.c index c4240d2a..5e8ea357 100644 --- a/filesetup.c +++ b/filesetup.c @@ -110,7 +110,7 @@ static int extend_file(struct thread_data *td, struct fio_file *f) { int new_layout = 0, unlink_file = 0, flags; unsigned long long left; - unsigned int bs; + unsigned int bs, alloc_size = 0; char *b = NULL; if (read_only) { @@ -204,7 +204,8 @@ static int extend_file(struct thread_data *td, struct fio_file *f) if (bs > left) bs = left; - b = fio_memalign(page_size, bs); + alloc_size = bs; + b = fio_memalign(page_size, alloc_size); if (!b) { td_verror(td, errno, "fio_memalign"); goto err; @@ -259,14 +260,14 @@ static int extend_file(struct thread_data *td, struct fio_file *f) f->io_size = f->real_file_size; } - fio_memfree(b, bs); + fio_memfree(b, alloc_size); done: return 0; err: close(f->fd); f->fd = -1; if (b) - fio_memfree(b, bs); + fio_memfree(b, alloc_size); return 1; }