summaryrefslogtreecommitdiff
path: root/t/btrace2fio.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-10-14 19:55:18 -0600
committerJens Axboe <axboe@fb.com>2014-10-14 19:55:18 -0600
commit18be35e85942fc4553d580fd14c9eb1b94153111 (patch)
tree3ff4da73d2491d9e3230861041c742c50e2a9db3 /t/btrace2fio.c
parent356c552d4654dba6ebc8461228ab0aa728d304c2 (diff)
downloadfio-18be35e85942fc4553d580fd14c9eb1b94153111.tar.gz
fio-18be35e85942fc4553d580fd14c9eb1b94153111.tar.bz2
t/btrace2fio: fix fd leak on error
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 't/btrace2fio.c')
-rw-r--r--t/btrace2fio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/t/btrace2fio.c b/t/btrace2fio.c
index 5666a560..baf29acb 100644
--- a/t/btrace2fio.c
+++ b/t/btrace2fio.c
@@ -870,9 +870,11 @@ static int trace_needs_swap(const char *trace_file, int *swap)
ret = read(fd, &t, sizeof(t));
if (ret < 0) {
+ close(fd);
perror("read");
return 1;
} else if (ret != sizeof(t)) {
+ close(fd);
log_err("fio: short read on trace file\n");
return 1;
}