[ntp:bk-ntp-dev-send] BitKeeper diffs

Harlan Stenn stenn at deacon.udel.edu
Mon Apr 18 23:11:16 UTC 2011


#### ChangeSet ####
2011-04-18 22:32:32+00:00, davehart at shiny.ad.hartbrothers.com
  [Bug 1851] freeaddrinfo() called after getaddrinfo() fails.

==== ChangeLog ====
2011-04-18 22:32:30+00:00, davehart at shiny.ad.hartbrothers.com +1 -0
  [Bug 1851] freeaddrinfo() called after getaddrinfo() fails.

--- 1.857/ChangeLog	2011-04-18 00:58:42 -04:00
+++ 1.858/ChangeLog	2011-04-18 18:32:30 -04:00
@@ -1,3 +1,4 @@
+* [Bug 1851] freeaddrinfo() called after getaddrinfo() fails.
 (4.2.7p155) 2011/04/18 Released by Harlan Stenn <stenn at ntp.org>
 * Fix leak in refclock_datum.c start failure path.
 (4.2.7p154) 2011/04/17 Released by Harlan Stenn <stenn at ntp.org>

==== libntp/ntp_intres.c ====
2011-04-18 22:32:30+00:00, davehart at shiny.ad.hartbrothers.com +8 -7
  [Bug 1851] freeaddrinfo() called after getaddrinfo() fails.

--- 1.95/libntp/ntp_intres.c	2011-04-11 17:24:10 -04:00
+++ 1.96/libntp/ntp_intres.c	2011-04-18 18:32:30 -04:00
@@ -358,7 +358,7 @@ blocking_getaddrinfo(
 #endif
 	canons_octets = 0;
 
-	if (!gai_resp->retcode) {
+	if (0 == gai_resp->retcode) {
 		ai = ai_res;
 		while (NULL != ai) {
 			gai_resp->ai_count++;
@@ -400,7 +400,7 @@ blocking_getaddrinfo(
 	cp = (void *)(gai_resp + 1);
 	canons_octets = 0;
 
-	if (!gai_resp->retcode) {
+	if (0 == gai_resp->retcode) {
 		ai = ai_res;
 		while (NULL != ai) {
 			memcpy(cp, ai, sizeof(*ai));
@@ -437,6 +437,7 @@ blocking_getaddrinfo(
 
 			ai = ai->ai_next;
 		}
+		freeaddrinfo(ai_res);
 	}
 
 	/*
@@ -505,7 +506,7 @@ getaddrinfo_sometime_complete(
 		/*
 		 * exponential backoff of DNS retries to 64s
 		 */
-		if (gai_req->retry && again) {
+		if (gai_req->retry > 0 && again) {
 			/* log the first retry only */
 			if (INITIAL_DNS_RETRY == gai_req->retry)
 				NLOG(NLOG_SYSINFO) {
@@ -745,7 +746,7 @@ blocking_getnameinfo(
 		gni_resp->gni_errno = errno;
 #endif
 
-	if (gni_resp->retcode) {
+	if (0 != gni_resp->retcode) {
 		gni_resp->hostoctets = 0;
 		gni_resp->servoctets = 0;
 	} else {
@@ -780,7 +781,7 @@ blocking_getnameinfo(
 	/* cp serves as our current pointer while serializing */
 	cp = (void *)(gni_resp + 1);
 
-	if (!gni_resp->retcode) {
+	if (0 == gni_resp->retcode) {
 		memcpy(cp, host, gni_resp->hostoctets);
 		cp += gni_resp->hostoctets;
 		memcpy(cp, service, gni_resp->servoctets);
@@ -840,12 +841,12 @@ getnameinfo_sometime_complete(
 		/*
 		 * exponential backoff of DNS retries to 64s
 		 */
-		if (gni_req->retry)
+		if (gni_req->retry > 0)
 			manage_dns_retry_interval(&gni_req->scheduled,
 			    &gni_req->earliest, &gni_req->retry,
 			    &child_ctx->next_dns_timeslot);
 
-		if (gni_req->retry && again) {
+		if (gni_req->retry > 0 && again) {
 			if (!queue_blocking_request(
 				BLOCKING_GETNAMEINFO,
 				gni_req,


More information about the bk-ntp-dev-send mailing list