diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-12-24 09:26:42 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-12-24 09:26:42 +0100 |
commit | 11df27bbf33664611840abca158d4f75e79eaa0b (patch) | |
tree | 6c22123ae82c70f69306faa71494dab7aca08c95 | |
parent | c2ba3eb9d659b612bddef2509083c1e32cc1105f (diff) | |
download | cmocka-11df27bbf33664611840abca158d4f75e79eaa0b.tar.gz cmocka-11df27bbf33664611840abca158d4f75e79eaa0b.tar.bz2 cmocka-11df27bbf33664611840abca158d4f75e79eaa0b.zip |
tests: Close the fd in test_assert_macros_fail.
This is not really necessary but it fixes Coverity.
CID #1146810
-rw-r--r-- | tests/test_assert_macros_fail.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test_assert_macros_fail.c b/tests/test_assert_macros_fail.c index c7c2088..cd49023 100644 --- a/tests/test_assert_macros_fail.c +++ b/tests/test_assert_macros_fail.c @@ -14,12 +14,16 @@ **************************************/ static void test_assert_return_code_fail(void **state) { - int rc; + int fd; (void)state; /* unused */ - rc = open("this_file_doesnt_exist.cmocka", 0); - assert_return_code(rc, errno); + fd = open("this_file_doesnt_exist.cmocka", 0); + assert_return_code(fd, errno); + + if (fd >= 0) { + close(fd); + } } int main(void) { |