]> granicus.if.org Git - neomutt/commitdiff
clean up on exit
authorRichard Russon <rich@flatcap.org>
Sun, 26 Aug 2018 23:28:55 +0000 (00:28 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 27 Aug 2018 09:40:20 +0000 (10:40 +0100)
main.c
ncrypt/crypt_mod.c
ncrypt/ncrypt.h

diff --git a/main.c b/main.c
index 3b3cbffcf39cd0cbbc413331ab6bf9aa47c65364..5cd767a8159be421c264e4602e8a09dad284b429 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1215,7 +1215,6 @@ int main(int argc, char *argv[], char *envp[])
     log_queue_empty();
     mutt_log_stop();
     cs_free(&Config);
-    mutt_window_free();
     // TEST43: neomutt (no change to mailbox)
     // TEST44: neomutt (change mailbox)
   }
@@ -1230,6 +1229,8 @@ main_curses:
   if (repeat_error && ErrorBufMessage)
     puts(ErrorBuf);
 main_exit:
+  crypto_module_free();
+  mutt_window_free();
   mutt_envlist_free();
   mutt_free_opts();
   mutt_free_keys();
index 110c9be22a2af2abab80947c9a0d3cfa0bfb7555..0d7c504e2be1ef7ba8a86405a92d74579f734eb4 100644 (file)
@@ -73,3 +73,17 @@ struct CryptModuleSpecs *crypto_module_lookup(int identifier)
   }
   return NULL;
 }
+
+/**
+ * crypto_module_free - Clean up the crypto modules
+ */
+void crypto_module_free(void)
+{
+  struct CryptModule *np = NULL, *tmp = NULL;
+  STAILQ_FOREACH_SAFE(np, &CryptModules, entries, tmp)
+  {
+    STAILQ_REMOVE(&CryptModules, np, CryptModule, entries);
+    FREE(&np);
+  }
+}
+
index 58dc7368facd1939edcefd140be5b5779cac408e..588e70f03f914fad329089a7be5a1ee751ff094d 100644 (file)
@@ -211,4 +211,7 @@ void         crypt_smime_getkeys(struct Envelope *env);
 int          crypt_smime_send_menu(struct Header *msg);
 int          crypt_smime_verify_sender(struct Header *h);
 
+/* crypt_mod.c */
+void crypto_module_free(void);
+
 #endif /* _NCRYPT_NCRYPT_H */