Don't exit loop early leaving uninitialized entries

Update for commit affc63cba8.

The original patch from Gregor Jasny did not have the break
statement; I incorrectly added it to prevent continuing the loop.
However, the later entries in the array would then be left
uninitialized, causing problems for later cleanup.

So fix to match Gregor's original patch, with apologies.
pull/32/merge
David Drysdale 9 years ago
parent c49a87eea5
commit 66f40230a0
  1. 4
      ares_init.c

@ -1205,10 +1205,8 @@ static int init_by_resolv_conf(ares_channel channel)
channel->ndomains = entries;
for (int i = 0; i < channel->ndomains; ++i) {
channel->domains[i] = strdup(res.dnsrch[i]);
if (!channel->domains[i]) {
if (!channel->domains[i])
status = ARES_ENOMEM;
break;
}
}
}
}

Loading…
Cancel
Save