summaryrefslogtreecommitdiffstats
path: root/buffy.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2019-04-16 12:23:42 -0700
committerKevin McCarthy <kevin@8t8.us>2019-04-16 12:23:42 -0700
commit6317a30369ef23b8e1b5e87692b93aa7bb9d1aaf (patch)
tree259cc01de853d3c3a4c20d9999fa684b22e1e2e9 /buffy.c
parent4084bda4b1aa83f7f858eddda59343a931624998 (diff)
Change BUFFY->realpath to be const char *.
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.
Diffstat (limited to 'buffy.c')
-rw-r--r--buffy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/buffy.c b/buffy.c
index d413abf5..0fef877c 100644
--- a/buffy.c
+++ b/buffy.c
@@ -235,7 +235,7 @@ static BUFFY *buffy_new (const char *path)
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;
@@ -244,6 +244,10 @@ static BUFFY *buffy_new (const char *path)
static void buffy_free (BUFFY **mailbox)
{
+ if (!(mailbox && *mailbox))
+ return;
+
+ FREE (&((*mailbox)->realpath));
FREE (mailbox); /* __FREE_CHECKED__ */
}