From 2223d789e6a61a4cfe308b1ca96b54392f803b00 Mon Sep 17 00:00:00 2001 From: dougb Date: Sat, 7 Nov 2009 18:55:39 +0000 Subject: Wrap some socket handling code in a !NULL bow This patch or something similar will likely be included in a future BIND release. PR: bin/138061 Submitted by: Michael Baker Original patch submitted by: Volker Patch reviewed and tweaked by: ISC --- contrib/bind9/bin/dig/dighost.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'contrib/bind9') diff --git a/contrib/bind9/bin/dig/dighost.c b/contrib/bind9/bin/dig/dighost.c index 470261c..73264e6 100644 --- a/contrib/bind9/bin/dig/dighost.c +++ b/contrib/bind9/bin/dig/dighost.c @@ -2604,10 +2604,12 @@ connect_done(isc_task_t *task, isc_event_t *event) { if (sevent->result == ISC_R_CANCELED) { debug("in cancel handler"); - isc_socket_detach(&query->sock); - sockcount--; - INSIST(sockcount >= 0); - debug("sockcount=%d", sockcount); + if (query->sock != NULL) { + isc_socket_detach(&query->sock); + sockcount--; + INSIST(sockcount >= 0); + debug("sockcount=%d", sockcount); + } query->waiting_connect = ISC_FALSE; isc_event_free(&event); l = query->lookup; -- cgit v1.1