Merge pull request #231 from huitema/develop

Fixing several issues in function set_os_defaults_windows that preven…
This commit is contained in:
wtoorop 2016-12-05 11:02:07 +01:00 committed by GitHub
commit fd97d2724d
1 changed files with 8 additions and 5 deletions

View File

@ -929,6 +929,7 @@ set_os_defaults_windows(struct getdns_context *context)
getdns_upstream *upstream; getdns_upstream *upstream;
size_t length; size_t length;
int s; int s;
uint32_t info_err = 0;
if (context->fchg_resolvconf == NULL) { if (context->fchg_resolvconf == NULL) {
context->fchg_resolvconf = context->fchg_resolvconf =
@ -961,15 +962,16 @@ set_os_defaults_windows(struct getdns_context *context)
if (info == NULL) if (info == NULL)
return GETDNS_RETURN_GENERIC_ERROR; return GETDNS_RETURN_GENERIC_ERROR;
if (GetNetworkParams(info, &buflen) == ERROR_BUFFER_OVERFLOW) { if ((info_err = GetNetworkParams(info, &buflen)) == ERROR_BUFFER_OVERFLOW) {
free(info); free(info);
info = (FIXED_INFO *)malloc(buflen); info = (FIXED_INFO *)malloc(buflen);
if (info == NULL) if (info == NULL)
return GETDNS_RETURN_GENERIC_ERROR; return GETDNS_RETURN_GENERIC_ERROR;
info_err = GetNetworkParams(info, &buflen);
} }
if (GetNetworkParams(info, &buflen) == NO_ERROR) { if (info_err == NO_ERROR) {
ptr = info->DnsServerList.Next; ptr = &info->DnsServerList;
*domain = 0; *domain = 0;
while (ptr) { while (ptr) {
for (size_t i = 0; i < GETDNS_UPSTREAM_TRANSPORTS; i++) { for (size_t i = 0; i < GETDNS_UPSTREAM_TRANSPORTS; i++) {
@ -986,10 +988,11 @@ set_os_defaults_windows(struct getdns_context *context)
freeaddrinfo(result); freeaddrinfo(result);
} }
ptr = ptr->Next; ptr = ptr->Next;
}
}
} if (info != NULL)
free(info); free(info);
}
suffix = getdns_list_create_with_context(context); suffix = getdns_list_create_with_context(context);