Skip to content
Permalink
Browse files

tests: net: socket: register: Do not close invalid fd

If the socket descriptor is invalid (fd < 0), there is no
need to try to close it.

Coverity-CID: 198949
Fixes #16785

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar authored and nashif committed Jul 3, 2019
1 parent 922c7ec commit 06136e5670ed84869720405b966197cd95cb8f39
Showing with 3 additions and 1 deletion.
  1. +3 −1 tests/net/socket/register/src/main.c
@@ -247,7 +247,9 @@ void test_create_sockets(void)
failed_tests++;
}

close(fd);
if (fd >= 0) {
close(fd);
}
}

zassert_equal(ok_tests + failed_tests - failed_family, func_called,

0 comments on commit 06136e5

Please sign in to comment.
You can’t perform that action at this time.