From f3e1eb23a6c900921caa58c6cad66d3b60b0b6d7 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 11 Apr 2014 11:28:54 -0600 Subject: [PATCH] Fix leak on error path in extend_file() Signed-off-by: Jens Axboe --- filesetup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/filesetup.c b/filesetup.c index 6d46ca3c..bf56112b 100644 --- a/filesetup.c +++ b/filesetup.c @@ -38,7 +38,7 @@ static int extend_file(struct thread_data *td, struct fio_file *f) int r, new_layout = 0, unlink_file = 0, flags; unsigned long long left; unsigned int bs; - char *b; + char *b = NULL; if (read_only) { log_err("fio: refusing extend of file due to read-only\n"); @@ -189,6 +189,8 @@ done: err: close(f->fd); f->fd = -1; + if (b) + free(b); return 1; } -- 2.25.1