]> diplodocus.org Git - nmh/blobdiff - sbr/folder_pack.c
Fix invalid pointer arithmetic.
[nmh] / sbr / folder_pack.c
index b0bc67b3b249907c4e1ed1ebfc71bf354ea980a3..22c0207926978f2a463ba064feac07a0c1335202 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * folder_pack.c -- pack (renumber) the messages in a folder
+/* folder_pack.c -- pack (renumber) the messages in a folder
  *               -- into a contiguous range from 1 to n.
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
@@ -35,12 +33,11 @@ folder_pack (struct msgs **mpp, int verbose)
      * for all numbers from 1 to current high message.
      */
     if (mp->lowoff > 1) {
-       if ((mp = folder_realloc (mp, 1, mp->hghmsg)))
-           *mpp = mp;
-       else {
-           advise (NULL, "unable to allocate folder storage");
+       if (!(mp = folder_realloc(mp, 1, mp->hghmsg))) {
+           inform("unable to allocate folder storage");
            return -1;
        }
+        *mpp = mp;
     }
 
     for (msgnum = mp->lowmsg, hole = 1; msgnum <= mp->hghmsg; msgnum++) {