diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2011-10-14 17:47:42 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-12-23 15:49:01 +0100 |
commit | 41e8b28fc02fd966dd089a79dc509a5eff725319 (patch) | |
tree | 055f977dbff0ed0b551396d52586513e10909f0f | |
parent | 811e804c7a403783b0c4cc5eb75f24da809081d8 (diff) | |
download | uClibc-alpine-41e8b28fc02fd966dd089a79dc509a5eff725319.tar.bz2 uClibc-alpine-41e8b28fc02fd966dd089a79dc509a5eff725319.tar.xz |
resolv: fix memory leak
Timothy Holdener writes:
small memory leak in __dns_lookup() when the A record
in the DNS answer is preceded by one or more CNAME records.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
(cherry picked from commit bb8d500a75a3050fe3198773ce7b07f669fe8f13)
-rw-r--r-- | libc/inet/resolv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 2371fb952..8781196c6 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1503,6 +1503,7 @@ int attribute_hidden __dns_lookup(const char *name, DPRINTF("Decoding answer at pos %d\n", pos); first_answer = 1; + a->dotted = NULL; for (j = 0; j < h.ancount; j++) { i = __decode_answer(packet, pos, packet_len, &ma); if (i < 0) { @@ -1519,6 +1520,7 @@ int attribute_hidden __dns_lookup(const char *name, ma.buf = a->buf; ma.buflen = a->buflen; ma.add_count = a->add_count; + free(a->dotted); memcpy(a, &ma, sizeof(ma)); if (a->atype != T_SIG && (NULL == a->buf || (type != T_A && type != T_AAAA))) break; |