From 48a84955743976049efea885d247724e42e8eff8 Mon Sep 17 00:00:00 2001 From: Doug Barton Date: Sat, 7 Nov 2009 18:55:39 +0000 Subject: [PATCH] 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(-) diff --git a/contrib/bind9/bin/dig/dighost.c b/contrib/bind9/bin/dig/dighost.c index 470261cb2da7..73264e6c2ce9 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;