[ADNS][DNSAPI] Fix a local resolving regression that led to some browsers crashing after startup. By Peter Hater. CORE-12072 CORE-12088

svn path=/trunk/; revision=72898
This commit is contained in:
Amine Khaldi 2016-10-04 07:55:15 +00:00
parent 1c4750792d
commit 2a4fd5b529
2 changed files with 10 additions and 9 deletions

View file

@ -771,6 +771,12 @@ DnsQuery_W(LPCWSTR Name,
}
adns_error = adns_init(&astate, adns_if_noenv | adns_if_noerrprint | adns_if_noserverwarn, 0);
if (adns_error != adns_s_ok)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
return DnsIntTranslateAdnsToDNS_STATUS(adns_error);
}
for (pip = &(network_info->DnsServerList); pip; pip = pip->Next)
{
addr.s_addr = inet_addr(pip->IpAddress.String);
@ -783,12 +789,6 @@ DnsQuery_W(LPCWSTR Name,
}
RtlFreeHeap(RtlGetProcessHeap(), 0, network_info);
if (adns_error != adns_s_ok)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, AnsiName);
return DnsIntTranslateAdnsToDNS_STATUS(adns_error);
}
if (Servers)
{
for (i = 0; i < Servers->AddrCount; i++)

View file

@ -521,17 +521,18 @@ static int init_begin(adns_state *ads_r, adns_initflags flags, FILE *diagfile) {
}
static int init_finish(adns_state ads) {
struct in_addr ia;
struct protoent *proto;
int r;
/* Don't add loopback on ReactOS it slows down queries to non existent server */
#ifndef __REACTOS__
struct in_addr ia;
if (!ads->nservers) {
if (ads->diagfile && ads->iflags & adns_if_debug)
fprintf(ads->diagfile,"adns: no nameservers, using localhost\n");
ia.s_addr= htonl(INADDR_LOOPBACK);
addserver(ads,ia);
}
#endif
proto= getprotobyname("udp"); if (!proto) { r= ENOPROTOOPT; goto x_free; }
ADNS_CLEAR_ERRNO;
ads->udpsocket= socket(AF_INET,SOCK_DGRAM,proto->p_proto);