Without this, start_udp or start_tcp would trigger an assertion
failure. Detaching it at this point is also consistent with
other failure handling cases, such as in recv_done.
return false;
}
+ /*
+ * We reach here only when either start_udp or start_tcp fails in
+ * get_address(), at which point lookup's current_query must be attached
+ * to the query that just failed. We need to detach it before trying
+ * the next server similar to, e.g., recv_done().
+ */
+ query_detach(&lookup->current_query);
+
debug("trying next server...");
if (lookup->tcp_mode) {