simplify whatnow.c/main() function
[mmh] / sbr / folder_realloc.c
index 47b9281..64a6640 100644 (file)
@@ -54,7 +54,7 @@ folder_realloc(struct msgs *mp, int lo, int hi)
                seqset_t *tmpstats;
 
                /* first allocate the new message status space */
-               tmpstats = mh_xmalloc(MSGSTATSIZE(mp, lo, hi));
+               tmpstats = mh_xcalloc(MSGSTATSIZE(mp, lo, hi), 1);
 
                /* then copy messages status array with shift */
                if (mp->nummsg > 0) {
@@ -62,7 +62,7 @@ folder_realloc(struct msgs *mp, int lo, int hi)
                                tmpstats[msgnum - lo] = mp->msgstats[msgnum - mp->lowoff];
                        }
                }
-               free(mp->msgstats);
+               mh_free0(&(mp->msgstats));
                mp->msgstats = tmpstats;
        }