potential bug fix
This commit is contained in:
@@ -589,6 +589,7 @@ static struct dns_query_struct *_dns_client_get_request(unsigned short sid, char
|
||||
}
|
||||
|
||||
query_result = query;
|
||||
_dns_client_query_get(query_result);
|
||||
break;
|
||||
}
|
||||
pthread_mutex_unlock(&client.domain_map_lock);
|
||||
@@ -679,16 +680,21 @@ static int _dns_client_recv(struct dns_server_info *server_info, unsigned char *
|
||||
/* get query reference */
|
||||
query = _dns_client_get_request(packet->head.id, domain);
|
||||
if (query == NULL || (query && has_opt == 0 && server_info->result_flag & DNSSERVER_FLAG_CHECK_EDNS)) {
|
||||
if (query) {
|
||||
_dns_client_query_release(query);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* avoid multiple replies */
|
||||
if (_dns_replied_check_add(query, (struct sockaddr *)from, from_len) != 0) {
|
||||
_dns_client_query_release(query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
request_num = atomic_dec_return(&query->dns_request_sent);
|
||||
if (request_num < 0) {
|
||||
_dns_client_query_release(query);
|
||||
tlog(TLOG_ERROR, "send count is invalid, %d", request_num);
|
||||
return -1;
|
||||
}
|
||||
@@ -702,6 +708,7 @@ static int _dns_client_recv(struct dns_server_info *server_info, unsigned char *
|
||||
}
|
||||
}
|
||||
|
||||
_dns_client_query_release(query);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1075,6 +1075,7 @@ static int _fast_ping_process_icmp(struct ping_host_struct *ping_host, struct ti
|
||||
{
|
||||
if (recv_ping_host->addr_len == from_len && memcmp(&recv_ping_host->addr, &from, from_len) == 0 && recv_ping_host->sid == sid &&
|
||||
recv_ping_host->cookie == cookie) {
|
||||
_fast_ping_host_get(recv_ping_host);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1086,6 +1087,7 @@ static int _fast_ping_process_icmp(struct ping_host_struct *ping_host, struct ti
|
||||
}
|
||||
|
||||
if (recv_ping_host->seq != seq) {
|
||||
_fast_ping_host_put(recv_ping_host);
|
||||
tlog(TLOG_ERROR, "seq num mismatch, expect %u, real %u", recv_ping_host->seq, seq);
|
||||
return -1;
|
||||
}
|
||||
@@ -1103,6 +1105,7 @@ static int _fast_ping_process_icmp(struct ping_host_struct *ping_host, struct ti
|
||||
_fast_ping_host_remove(recv_ping_host);
|
||||
}
|
||||
|
||||
_fast_ping_host_put(recv_ping_host);
|
||||
return 0;
|
||||
errout:
|
||||
return -1;
|
||||
@@ -1195,6 +1198,7 @@ static int _fast_ping_process_udp(struct ping_host_struct *ping_host, struct tim
|
||||
hash_for_each_possible(ping.addrmap, recv_ping_host, addr_node, addrkey)
|
||||
{
|
||||
if (recv_ping_host->addr_len == from_len && memcmp(&recv_ping_host->addr, &from, from_len) == 0 && recv_ping_host->sid == sid) {
|
||||
_fast_ping_host_get(recv_ping_host);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1219,6 +1223,8 @@ static int _fast_ping_process_udp(struct ping_host_struct *ping_host, struct tim
|
||||
_fast_ping_host_remove(recv_ping_host);
|
||||
}
|
||||
|
||||
_fast_ping_host_put(recv_ping_host);
|
||||
|
||||
return 0;
|
||||
errout:
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user