ahost: Allow repeated -s <domain> options

This also removes a potential leak where later -s options would
replace earlier ones without freeing the relevant string.
pull/34/head
David Drysdale 9 years ago
parent 87ff25049c
commit 4ad3111a49
  1. 7
      ahost.c

@ -87,9 +87,10 @@ int main(int argc, char **argv)
break;
case 's':
optmask |= ARES_OPT_DOMAINS;
options.ndomains = 1;
options.domains = malloc(options.ndomains * sizeof(char *));
options.domains[0] = strdup(optarg);
options.ndomains++;
options.domains = realloc(options.domains,
options.ndomains * sizeof(char *));
options.domains[options.ndomains - 1] = strdup(optarg);
break;
case 't':
if (!strcasecmp(optarg,"a"))

Loading…
Cancel
Save