summaryrefslogtreecommitdiffstats
path: root/buffy.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-07-22 14:55:01 -0700
committerKevin McCarthy <kevin@8t8.us>2016-07-22 14:55:01 -0700
commit6c700ca21bdfef472747882dda0fe466635cc0d8 (patch)
tree34059506e274b45d2d2fd376073649a1dac9b117 /buffy.c
parentf30a4cdbde4adc5468a797f50c6bc88eb790a00c (diff)
Convert buffy_mbox_check() and trash_append() to use local context.
buffy_mbox_check() was leaking the dynamically allocated context. Rather than add a call to free, just convert it to use a local variable. Make the same change to trash_append(), which doesn't need the dynamically allocated context either.
Diffstat (limited to 'buffy.c')
-rw-r--r--buffy.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/buffy.c b/buffy.c
index 50bda350..508136a5 100644
--- a/buffy.c
+++ b/buffy.c
@@ -417,7 +417,7 @@ static int buffy_mbox_check (BUFFY* mailbox, struct stat *sb, int check_stats)
{
int rc = 0;
int new_or_changed;
- CONTEXT *ctx = NULL;
+ CONTEXT ctx;
if (option (OPTCHECKMBOXSIZE))
new_or_changed = sb->st_size > mailbox->size;
@@ -446,15 +446,15 @@ static int buffy_mbox_check (BUFFY* mailbox, struct stat *sb, int check_stats)
if (check_stats &&
(mailbox->stats_last_checked < sb->st_mtime))
{
- if ((ctx = mx_open_mailbox (mailbox->path,
- MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
- NULL)) != NULL)
+ if (mx_open_mailbox (mailbox->path,
+ MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
+ &ctx) != NULL)
{
- mailbox->msg_count = ctx->msgcount;
- mailbox->msg_unread = ctx->unread;
- mailbox->msg_flagged = ctx->flagged;
- mailbox->stats_last_checked = ctx->mtime;
- mx_close_mailbox (ctx, 0);
+ mailbox->msg_count = ctx.msgcount;
+ mailbox->msg_unread = ctx.unread;
+ mailbox->msg_flagged = ctx.flagged;
+ mailbox->stats_last_checked = ctx.mtime;
+ mx_close_mailbox (&ctx, 0);
}
}