From: Jens Axboe Date: Wed, 15 Oct 2014 01:55:18 +0000 (-0600) Subject: t/btrace2fio: fix fd leak on error X-Git-Tag: fio-2.1.14~54 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=18be35e85942fc4553d580fd14c9eb1b94153111;p=fio.git t/btrace2fio: fix fd leak on error Signed-off-by: Jens Axboe --- 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; }