]> diplodocus.org Git - nmh/blobdiff - uip/ap.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / ap.c
index 2671375fcf2bc83b6877d6b948a4f2beecb3869c..8265723e8c981581aa1f9e702a5e0b28e81a9dec 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -1,5 +1,4 @@
-/*
- * ap.c -- parse addresses 822-style
+/* ap.c -- parse addresses 822-style
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -11,6 +10,7 @@
 #include <h/fmt_scan.h>
 #include <h/mts.h>
 #include <h/utils.h>
+#include "sbr/terminal.h"
 
 #define        NADDRS  100
 
@@ -96,8 +96,7 @@ main (int argc, char **argv)
        }
        if (addrp == NADDRS)
            adios (NULL, "more than %d addresses", NADDRS);
-       else
-           addrs[addrp++] = cp;
+        addrs[addrp++] = cp;
     }
     addrs[addrp] = NULL;
 
@@ -129,7 +128,7 @@ main (int argc, char **argv)
        status += process (addrs[addrp], width);
 
     fmt_free (fmt, 1);
-    done (status);
+    done(!!status);
     return 1;
 }
 
@@ -172,13 +171,13 @@ process (char *arg, int length)
 
        cptr = fmt_findcomp ("text");
        if (cptr) {
-            mh_xfree(cptr->c_text);
+            free(cptr->c_text);
            cptr->c_text = p->pq_text;
            p->pq_text = NULL;
        }
        cptr = fmt_findcomp ("error");
        if (cptr) {
-            mh_xfree(cptr->c_text);
+            free(cptr->c_text);
            cptr->c_text = p->pq_error;
            p->pq_error = NULL;
        }
@@ -187,8 +186,8 @@ process (char *arg, int length)
        fputs (charstring_buffer (scanl), stdout);
        charstring_free (scanl);
 
-        mh_xfree(p->pq_text);
-        mh_xfree(p->pq_error);
+        free(p->pq_text);
+        free(p->pq_error);
        q = p->pq_next;
        free(p);
     }