From a1116723d40b402d0690061c1b23858c33953d79 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 14 Jun 2011 16:48:26 +0200 Subject: [PATCH] Do not leak rr_name on failures inside ares_parse_a_reply --- ares_parse_a_reply.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ares_parse_a_reply.c b/ares_parse_a_reply.c index 9301254..66d9bdf 100644 --- a/ares_parse_a_reply.c +++ b/ares_parse_a_reply.c @@ -132,6 +132,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, aptr += len; if (aptr + RRFIXEDSZ > abuf + alen) { + free(rr_name); status = ARES_EBADRESP; break; } @@ -149,6 +150,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, { if (aptr + sizeof(struct in_addr) > abuf + alen) { + free(rr_name); status = ARES_EBADRESP; break; } @@ -159,6 +161,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, struct ares_addrttl * const at = &addrttls[naddrs]; if (aptr + sizeof(struct in_addr) > abuf + alen) { + free(rr_name); status = ARES_EBADRESP; break; } -- 2.7.4