BUFFY->path is a fixed array (which will be converted to a BUFFER in
the next commit). This is needed to call mutt_expand_path().
However, BUFFY->realpath has no such need, and so it is a bit
wasteful (not to mention not big enough) to store as such.
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
strfcpy (buffy->path, path, sizeof (buffy->path));
r = realpath (path, rp);
- strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
+ buffy->realpath = safe_strdup (r ? rp : path);
buffy->next = NULL;
buffy->magic = 0;
static void buffy_free (BUFFY **mailbox)
{
+ if (!(mailbox && *mailbox))
+ return;
+
+ FREE (&((*mailbox)->realpath));
FREE (mailbox); /* __FREE_CHECKED__ */
}
typedef struct buffy_t
{
char path[_POSIX_PATH_MAX];
- char realpath[_POSIX_PATH_MAX]; /* used for duplicate detection, context comparison,
- and the sidebar */
+ const char *realpath; /* used for duplicate detection, context comparison,
+ and the sidebar */
off_t size;
struct buffy_t *next;
short new; /* mailbox has new mail */