Use good m_ functions, because it smell like a flower, version 2.
[apps/madmutt.git] / lib-sys / mutt_ssl.c
index 1557a8f..5d7c551 100644 (file)
@@ -7,9 +7,7 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <lib-lib/lib-lib.h>
 
 #ifdef USE_SSL
 
 #include <openssl/err.h>
 #include <openssl/rand.h>
 
-#include <string.h>
-
-#include <lib-lib/lib-lib.h>
-
 #include <lib-ui/curses.h>
 #include <lib-ui/menu.h>
 
@@ -339,9 +333,6 @@ static int ssl_socket_close (CONNECTION * conn)
 
   if (data) {
     SSL_shutdown (data->ssl);
-#if 0
-    X509_free (data->cert);
-#endif
     SSL_free (data->ssl);
     SSL_CTX_free (data->ctx);
     p_delete(&conn->sockdata);
@@ -516,7 +507,7 @@ static int check_certificate_by_digest (X509 * peercert)
     return 0;
 
   if (!X509_digest (peercert, EVP_sha1 (), peermd, &peermdlen)) {
-    fclose (fp);
+    m_fclose(&fp);
     return 0;
   }
 
@@ -526,7 +517,7 @@ static int check_certificate_by_digest (X509 * peercert)
       break;
   }
   X509_free (cert);
-  fclose (fp);
+  m_fclose(&fp);
 
   return pass;
 }
@@ -630,7 +621,7 @@ static int ssl_check_certificate (sslsockdata * data)
       if ((fp = fopen (SslCertFile, "a"))) {
         if (PEM_write_X509 (fp, data->cert))
           done = 1;
-        fclose (fp);
+        m_fclose(&fp);
       }
       if (!done) {
         mutt_error (_("Warning: Couldn't save certificate"));