From: Danny Mayer Date: Mon, 20 Mar 2006 03:14:48 +0000 (-0500) Subject: Additional fixes for Coverity items X-Git-Tag: NTP_4_2_1P10_RC~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=511e616b5e11b1412e0ce601fdabc71935a9e4e4;p=thirdparty%2Fntp.git Additional fixes for Coverity items bk: 441e1e28rYGLdaVWAxsF61QBnmbJzg --- diff --git a/ntpd/ntp_restrict.c b/ntpd/ntp_restrict.c index 25047f916..04013a1d3 100644 --- a/ntpd/ntp_restrict.c +++ b/ntpd/ntp_restrict.c @@ -527,7 +527,7 @@ hack_restrict( rl6->addr6 = addr6; rl6->mask6 = mask6; rl6->mflags = (u_short)mflags; - if (rlprev6) { + if (rlprev6 != NULL) { rl6->next = rlprev6->next; rlprev6->next = rl6; } else { @@ -569,7 +569,7 @@ hack_restrict( if (rl6 != 0 && !IN6_IS_ADDR_UNSPECIFIED(&rl6->addr6) && !(rl6->mflags & RESM_INTERFACE)) { - if (rlprev6) { + if (rlprev6 != NULL) { rlprev6->next = rl6->next; } else { restrictlist6 = rl6->next; diff --git a/ntpdc/ntpdc.c b/ntpdc/ntpdc.c index c239d1b29..0609cd31b 100644 --- a/ntpdc/ntpdc.c +++ b/ntpdc/ntpdc.c @@ -472,6 +472,8 @@ openhost( } if (a_info != 0) { (void) fprintf(stderr, "%s\n", gai_strerror(a_info)); + if (ai != NULL) + freeaddrinfo(ai); return 0; } @@ -551,7 +553,8 @@ openhost( ai->ai_addrlen) == -1) #endif /* SYS_VXWORKS */ error("connect", "", ""); - freeaddrinfo(ai); + if (ai != NULL) + freeaddrinfo(ai); havehost = 1; req_pkt_size = REQ_LEN_NOMAC; impl_ver = IMPL_XNTPD;