From: Richard Russon Date: Thu, 6 Sep 2018 09:29:30 +0000 (+0100) Subject: notmuch: let mxapi do cleanup X-Git-Tag: 2019-10-25~657^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2cc85a0a776e2e68470c6fa8f73e4391203cadec;p=neomutt notmuch: let mxapi do cleanup --- diff --git a/mailbox.c b/mailbox.c index 8aead75f1..0a7aeab20 100644 --- a/mailbox.c +++ b/mailbox.c @@ -207,6 +207,7 @@ void mailbox_free(struct Mailbox **mailbox) FREE(&(*mailbox)->desc); if ((*mailbox)->free_data) (*mailbox)->free_data((*mailbox)->data); + (*mailbox)->data = NULL; FREE(mailbox); } diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 10329a983..7bacfbc53 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -936,11 +936,8 @@ static char *get_folder_from_path(const char *path) */ static void deinit_header(struct Header *h) { - if (h) - { - free_hdrdata(h->data); - h->data = NULL; - } + free_hdrdata(h->data); + h->data = NULL; } /** @@ -2496,22 +2493,11 @@ static int nm_mbox_open(struct Context *ctx) /** * nm_mbox_close - Implements MxOps::mbox_close() + * + * Nothing to do. */ static int nm_mbox_close(struct Context *ctx) { - if (!ctx || (ctx->mailbox->magic != MUTT_NOTMUCH)) - return -1; - - for (int i = 0; i < ctx->mailbox->msg_count; i++) - { - struct Header *h = ctx->mailbox->hdrs[i]; - if (h) - { - free_hdrdata(h->data); - h->data = NULL; - } - } - return 0; }