[Git][NTPsec/ntpsec][master] 2 commits: Coverity CID 185800 - explicitly ignore unchecked value.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Mar 18 23:04:56 UTC 2019



Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
dec8fe90 by Eric S. Raymond at 2019-03-18T22:56:32Z
Coverity CID 185800 - explicitly ignore unchecked value.

- - - - -
3b1e503e by Eric S. Raymond at 2019-03-18T23:03:46Z
Coverity CID 185792: socket resource leak.

- - - - -


2 changed files:

- ntpd/ntpd.c
- ntpd/nts_server.c


Changes:

=====================================
ntpd/ntpd.c
=====================================
@@ -631,7 +631,7 @@ ntpdmain(
 	sa.sa_handler = SIG_IGN;
 	sigemptyset(&sa.sa_mask);
 	sa.sa_flags = SA_RESTART;
- 	sigaction(SIGPIPE, &sa, NULL);
+ 	(void)sigaction(SIGPIPE, &sa, NULL);
 
 	/*
 	 * Set up signals we pay attention to locally.


=====================================
ntpd/nts_server.c
=====================================
@@ -239,15 +239,18 @@ int create_listener(int port, int family) {
 	err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
         if (0 > err) {
           msyslog(LOG_ERR, "NTSs: can't setsockopt4: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
         err = bind(sock, (struct sockaddr*)&addr, sizeof(addr));
         if (0 > err) {
           msyslog(LOG_ERR, "NTSs: can't bind4: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
         if (listen(sock, 6) < 0) {
           msyslog(LOG_ERR, "NTSs: can't listen4: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
         msyslog(LOG_INFO, "NTSs: listen4 worked");
@@ -265,20 +268,24 @@ int create_listener(int port, int family) {
         err = setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on));
         if (0 > err) {
           msyslog(LOG_ERR, "NTSs: can't setsockopt6only: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
 	err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
         if (0 > err) {
           msyslog(LOG_ERR, "NTSs: can't setsockopt6: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
         err = bind(sock, (struct sockaddr*)&addr6, sizeof(addr6));
         if (0 > err) {
           msyslog(LOG_ERR, "NTSs: can't bind6: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
         if (listen(sock, 6) < 0) {
           msyslog(LOG_ERR, "NTSs: can't listen6: %s", strerror(errno));
+	  close(sock);
           return -1;
         }
         msyslog(LOG_INFO, "NTSs: listen6 worked");



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/bf3dfbe30ad16b4d345dfe9d6c6d842d9321355f...3b1e503e525f94318a67372275771a804beb4e82

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/bf3dfbe30ad16b4d345dfe9d6c6d842d9321355f...3b1e503e525f94318a67372275771a804beb4e82
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190318/5fcd8c46/attachment-0001.html>


More information about the vc mailing list