]> granicus.if.org Git - neomutt/commitdiff
notmuch: let mxapi do cleanup
authorRichard Russon <rich@flatcap.org>
Thu, 6 Sep 2018 09:29:30 +0000 (10:29 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 9 Sep 2018 15:10:16 +0000 (16:10 +0100)
mailbox.c
notmuch/mutt_notmuch.c

index 8aead75f13fc31c3099245c9662085a129909e7c..0a7aeab208d550694b9858d1d4de7f2b8d3f32a0 100644 (file)
--- 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);
 }
index 10329a98371c2c85dd1dccb5b0560c6bd6b8e9c8..7bacfbc53bc6048322aa41d20841b273e213c419 100644 (file)
@@ -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;
 }