From 648eb8dfccf457fc2fbd01286718629b006524fa Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 11 Jun 2015 17:06:06 +0000 Subject: - Fix s6dns-resolve.h for C++ inclusion - Fix leak in s6dns_resolve_core.c - version: 2.0.0.4 --- src/include/s6-dns/s6dns-resolve.h | 2 +- src/libs6dns/s6dns_resolve_core.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/include/s6-dns/s6dns-resolve.h b/src/include/s6-dns/s6dns-resolve.h index e7eb629..805ea2a 100644 --- a/src/include/s6-dns/s6dns-resolve.h +++ b/src/include/s6-dns/s6dns-resolve.h @@ -220,7 +220,7 @@ extern int s6dns_resolve_mpag_r (stralloc *, genalloc *, char const *, unsigned */ extern int s6dns_resolven_loop (s6dns_engine_t_ref, unsigned int, unsigned int, tain_t const *, tain_t *) ; -#define s6dns_resolven_loop_g(list, n, or, deadline) s6dns_resolven(list, n, or, (deadline), &STAMP) +#define s6dns_resolven_loop_g(list, n, zor, deadline) s6dns_resolven(list, n, zor, (deadline), &STAMP) typedef struct s6dns_resolve_s s6dns_resolve_t, *s6dns_resolve_t_ref ; struct s6dns_resolve_s diff --git a/src/libs6dns/s6dns_resolve_core.c b/src/libs6dns/s6dns_resolve_core.c index 0b75f07..a3c51c1 100644 --- a/src/libs6dns/s6dns_resolve_core.c +++ b/src/libs6dns/s6dns_resolve_core.c @@ -11,6 +11,11 @@ int s6dns_resolve_core_r (s6dns_domain_t const *d, uint16 qtype, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp) { - return s6dns_engine_init_r(dt, servers, S6DNS_O_RECURSIVE, d->s, d->len, qtype, dbh, deadline, stamp) - && s6dns_resolve_loop_r(dt, deadline, stamp) ; + if (!s6dns_engine_init_r(dt, servers, S6DNS_O_RECURSIVE, d->s, d->len, qtype, dbh, deadline, stamp)) return 0 ; + if (!s6dns_resolve_loop_r(dt, deadline, stamp)) + { + s6dns_engine_recycle(dt) ; + return 0 ; + } + return 1 ; } -- cgit v1.2.3