X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/1dc931965d15b69def7e1fdd44b4397eca01e4c9..a0150d8deebfda4b52190738dd65c3d0f27d5756:/bres-adns.c diff --git a/bres-adns.c b/bres-adns.c index e0a034a..039ca69 100644 --- a/bres-adns.c +++ b/bres-adns.c @@ -7,7 +7,7 @@ * (c) 2003 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of the mLib utilities library. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * mLib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with mLib; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -39,6 +39,8 @@ * must be licensed under the full GPL. */ +#include "config.h" + #ifndef HAVE_ADNS # error "You need the ADNS library to compile this file." #endif @@ -227,7 +229,7 @@ static void report(bres_client *rc, adns_answer *a, h.h_addrtype = AF_INET; h.h_length = sizeof(struct in_addr); h.h_addr_list = aa; - rc->func(&h, rc->p); + rc->func(&h, rc->p); } /* --- @beforehook@, @afterhook@ --- * @@ -254,7 +256,7 @@ static void afterhook(sel_state *s, sel_args *sa, void *p) void *c; bres_client *rc; adns_query q; - adns_answer *a; + adns_answer *a, *aa; int e; int i; @@ -268,8 +270,8 @@ static void afterhook(sel_state *s, sel_args *sa, void *p) else switch (rc->q) { case adns_r_addr: assert(a->type == adns_r_addr); - report(rc, a, a->rrs.addr, a->nrrs, &a->owner, 1); xfree(rc->u.name); + report(rc, a, a->rrs.addr, a->nrrs, &a->owner, 1); free(a); break; case adns_r_ptr: @@ -289,8 +291,9 @@ static void afterhook(sel_state *s, sel_args *sa, void *p) } goto fail; match: - report(rc, a, &a->rrs.addr[i], 1, rc->a->rrs.str, rc->a->nrrs); - free(rc->a); + aa = rc->a; + report(rc, a, &a->rrs.addr[i], 1, aa->rrs.str, aa->nrrs); + free(aa); free(a); } break; @@ -300,9 +303,9 @@ static void afterhook(sel_state *s, sel_args *sa, void *p) continue; fail: - rc->func(0, rc->p); if (rc->q == adns_r_addr) xfree(rc->u.name); if (rc->a) free(rc->a); + rc->func(0, rc->p); free(a); } }