aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index b7a69b205..b17e41425 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -53,7 +53,6 @@ test_util_read_until_eof_impl(const char *fname, size_t file_len,
fd = open(fifo_name, O_RDONLY|O_BINARY);
tt_int_op(fd, >=, 0);
str = read_file_to_str_until_eof(fd, read_limit, &sz);
- close(fd);
tt_assert(str != NULL);
if (read_limit < file_len)
@@ -69,6 +68,8 @@ test_util_read_until_eof_impl(const char *fname, size_t file_len,
tor_free(fifo_name);
tor_free(test_str);
tor_free(str);
+ if (fd >= 0)
+ close(fd);
}
static void