diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-11 15:20:20 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-11 15:20:20 -0500 |
commit | 52263b0dda85632ea1deb0f05a83a39d4876f3ab (patch) | |
tree | ae54f15700896adda86bce5cb4170b14f7615ecd /src/test/test_util.c | |
parent | 96b1bd4fb8e64503c5038a764ece46d950917f07 (diff) | |
download | tor-52263b0dda85632ea1deb0f05a83a39d4876f3ab.tar.gz tor-52263b0dda85632ea1deb0f05a83a39d4876f3ab.zip |
Fix even more dead code and resource leaks in the unit tests
Found by coverity
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index b7a69b205e..b17e414255 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 |