Brad House provided a fix for ares_save_options(): Apparently I overlooked
something with the ares_save_options() where it would try to do a malloc(0) when no options of that type needed to be saved. On most platforms, this was fine because malloc(0) doesn't actually return NULL, but on AIX it does, so ares_save_options would return ARES_ENOMEM.
This commit is contained in:
parent
6c511abf43
commit
05b26e7566
10
ares/CHANGES
10
ares/CHANGES
@ -1,10 +1,18 @@
|
|||||||
Changelog for the c-ares project
|
Changelog for the c-ares project
|
||||||
|
|
||||||
|
* September 22 2007 (Daniel Stenberg)
|
||||||
|
|
||||||
|
- Brad House provided a fix for ares_save_options():
|
||||||
|
|
||||||
|
Apparently I overlooked something with the ares_save_options() where it
|
||||||
|
would try to do a malloc(0) when no options of that type needed to be saved.
|
||||||
|
On most platforms, this was fine because malloc(0) doesn't actually return
|
||||||
|
NULL, but on AIX it does, so ares_save_options would return ARES_ENOMEM.
|
||||||
|
|
||||||
* July 14 2007 (Daniel Stenberg)
|
* July 14 2007 (Daniel Stenberg)
|
||||||
|
|
||||||
- Vlad Dinulescu fixed two outstanding valgrind reports:
|
- Vlad Dinulescu fixed two outstanding valgrind reports:
|
||||||
|
|
||||||
|
|
||||||
1. In ares_query.c , in find_query_by_id we compare q->qid (which is a short
|
1. In ares_query.c , in find_query_by_id we compare q->qid (which is a short
|
||||||
int variable) with qid, which is declared as an int variable. Moreover,
|
int variable) with qid, which is declared as an int variable. Moreover,
|
||||||
DNS_HEADER_SET_QID is used to set the value of qid, but DNS_HEADER_SET_QID
|
DNS_HEADER_SET_QID is used to set the value of qid, but DNS_HEADER_SET_QID
|
||||||
|
@ -244,18 +244,22 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
|
|||||||
options->sock_state_cb_data = channel->sock_state_cb_data;
|
options->sock_state_cb_data = channel->sock_state_cb_data;
|
||||||
|
|
||||||
/* Copy servers */
|
/* Copy servers */
|
||||||
|
if (channel->nservers) {
|
||||||
options->servers =
|
options->servers =
|
||||||
malloc(channel->nservers * sizeof(struct server_state));
|
malloc(channel->nservers * sizeof(struct server_state));
|
||||||
if (!options->servers && channel->nservers != 0)
|
if (!options->servers && channel->nservers != 0)
|
||||||
return ARES_ENOMEM;
|
return ARES_ENOMEM;
|
||||||
for (i = 0; i < channel->nservers; i++)
|
for (i = 0; i < channel->nservers; i++)
|
||||||
options->servers[i] = channel->servers[i].addr;
|
options->servers[i] = channel->servers[i].addr;
|
||||||
|
}
|
||||||
options->nservers = channel->nservers;
|
options->nservers = channel->nservers;
|
||||||
|
|
||||||
/* copy domains */
|
/* copy domains */
|
||||||
|
if (channel->ndomains) {
|
||||||
options->domains = malloc(channel->ndomains * sizeof(char *));
|
options->domains = malloc(channel->ndomains * sizeof(char *));
|
||||||
if (!options->domains)
|
if (!options->domains)
|
||||||
return ARES_ENOMEM;
|
return ARES_ENOMEM;
|
||||||
|
|
||||||
for (i = 0; i < channel->ndomains; i++)
|
for (i = 0; i < channel->ndomains; i++)
|
||||||
{
|
{
|
||||||
options->ndomains = i;
|
options->ndomains = i;
|
||||||
@ -263,14 +267,18 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
|
|||||||
if (!options->domains[i])
|
if (!options->domains[i])
|
||||||
return ARES_ENOMEM;
|
return ARES_ENOMEM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
options->ndomains = channel->ndomains;
|
options->ndomains = channel->ndomains;
|
||||||
|
|
||||||
/* copy lookups */
|
/* copy lookups */
|
||||||
|
if (channel->lookups) {
|
||||||
options->lookups = strdup(channel->lookups);
|
options->lookups = strdup(channel->lookups);
|
||||||
if (!options->lookups)
|
if (!options->lookups && channel->lookups)
|
||||||
return ARES_ENOMEM;
|
return ARES_ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
/* copy sortlist */
|
/* copy sortlist */
|
||||||
|
if (channel->nsort) {
|
||||||
options->sortlist = malloc(channel->nsort * sizeof(struct apattern));
|
options->sortlist = malloc(channel->nsort * sizeof(struct apattern));
|
||||||
if (!options->sortlist)
|
if (!options->sortlist)
|
||||||
return ARES_ENOMEM;
|
return ARES_ENOMEM;
|
||||||
@ -279,6 +287,7 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
|
|||||||
memcpy(&(options->sortlist[i]), &(channel->sortlist[i]),
|
memcpy(&(options->sortlist[i]), &(channel->sortlist[i]),
|
||||||
sizeof(struct apattern));
|
sizeof(struct apattern));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
options->nsort = channel->nsort;
|
options->nsort = channel->nsort;
|
||||||
|
|
||||||
return ARES_SUCCESS;
|
return ARES_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user