chiark / gitweb /
cleanup: All the whitespace fixes, all at once.
[mLib] / bres-adns.c
index e0a034adbb488d69153d20a0f2b0d9206582cd91..0679207c23b32e2c42e97b8e68ec6482d43f3ef1 100644 (file)
@@ -7,7 +7,7 @@
  * (c) 2003 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of the mLib utilities library.
  *
  * 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,
@@ -227,7 +227,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 +254,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 +268,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 +289,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 +301,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);
   }
 }