Skip to content

Commit

Permalink
Do not leak rr_name on failures inside ares_parse_aaaa_reply
Browse files Browse the repository at this point in the history
  • Loading branch information
jhrozek committed Jun 14, 2011
1 parent 978a929 commit 18b6d47
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ares_parse_aaaa_reply.c
Expand Up @@ -132,6 +132,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
aptr += len; aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen) if (aptr + RRFIXEDSZ > abuf + alen)
{ {
free(rr_name);
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
Expand All @@ -149,6 +150,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
{ {
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) if (aptr + sizeof(struct ares_in6_addr) > abuf + alen)
{ {
free(rr_name);
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
Expand All @@ -159,6 +161,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct ares_addr6ttl * const at = &addrttls[naddrs]; struct ares_addr6ttl * const at = &addrttls[naddrs];
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen) if (aptr + sizeof(struct ares_in6_addr) > abuf + alen)
{ {
free(rr_name);
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
Expand Down

0 comments on commit 18b6d47

Please sign in to comment.