svn commit: r299059 - stable/10/contrib/netbsd-tests/lib/libc/sys
Garrett Cooper
ngie at FreeBSD.org
Wed May 4 07:39:25 UTC 2016
Author: ngie
Date: Wed May 4 07:39:23 2016
New Revision: 299059
URL: https://svnweb.freebsd.org/changeset/base/299059
Log:
MFC r298366:
Fix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c
- Ensure socket(2) calls succeed
- Don't leak slist allocated by earlier socket(2) call
CID: 976773, 1251405
Modified:
stable/10/contrib/netbsd-tests/lib/libc/sys/t_connect.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_connect.c
==============================================================================
--- stable/10/contrib/netbsd-tests/lib/libc/sys/t_connect.c Wed May 4 07:37:02 2016 (r299058)
+++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_connect.c Wed May 4 07:39:23 2016 (r299059)
@@ -56,6 +56,11 @@ ATF_TC_BODY(connect_low_port, tc)
slist = socket(AF_INET, SOCK_STREAM, 0);
sd = socket(AF_INET, SOCK_STREAM, 0);
+#ifdef __FreeBSD__
+ ATF_REQUIRE(sd > 0);
+ ATF_REQUIRE(slist > 0);
+#endif
+
/* bind listening socket */
memset(&sinlist, 0, sizeof(sinlist));
sinlist.sin_family = AF_INET;
@@ -92,6 +97,9 @@ ATF_TC_BODY(connect_low_port, tc)
ATF_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX);
close(sd);
+#ifdef __FreeBSD__
+ close(slist);
+#endif
}
ATF_TP_ADD_TCS(tp)
More information about the svn-src-stable
mailing list