X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mutt_socket.c;h=6bac9d41ccc3571c7b5a6bda75e4fe84b9789af6;hp=94dbfc52fb0eee54e3942f3146520efafaac5a1d;hb=9e6ab0152703ad301042ce8810859f41fbee405a;hpb=be393b838c5e0b8dfe9bedcc7a4a63f05caae7c4 diff --git a/mutt_socket.c b/mutt_socket.c index 94dbfc5..6bac9d4 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -13,6 +13,8 @@ # include "config.h" #endif +#include + #include "mutt.h" #include "globals.h" #include "mutt_socket.h" @@ -23,7 +25,6 @@ #include "mutt_idna.h" -#include "lib/mem.h" #include "lib/intl.h" #include "lib/str.h" #include "lib/debug.h" @@ -189,7 +190,7 @@ void mutt_socket_free (CONNECTION * conn) /* head is special case, doesn't need prev updated */ if (iter == conn) { Connections = iter->next; - mem_free (&iter); + p_delete(&iter); return; } @@ -197,7 +198,7 @@ void mutt_socket_free (CONNECTION * conn) if (iter->next == conn) { tmp = iter->next; iter->next = tmp->next; - mem_free (&tmp); + p_delete(&tmp); return; } iter = iter->next; @@ -237,10 +238,8 @@ CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account) if (Tunnel && *Tunnel) mutt_tunnel_socket_setup (conn); else if (account->flags & M_ACCT_SSL) { -#ifdef USE_SSL - ssl_socket_setup (conn); -#elif USE_GNUTLS - if (mutt_gnutls_socket_setup (conn) < 0) { +#if defined (USE_SSL) || defined (USE_GNUTLS) + if (mutt_ssl_socket_setup (conn) < 0) { mutt_socket_free (conn); return NULL; } @@ -326,7 +325,7 @@ static CONNECTION *socket_new_conn (void) { CONNECTION *conn; - conn = (CONNECTION *) mem_calloc (1, sizeof (CONNECTION)); + conn = p_new(CONNECTION, 1); conn->fd = -1; return conn; @@ -406,7 +405,7 @@ int raw_socket_open (CONNECTION * conn) rc = getaddrinfo (host_idna, port, &hints, &res); # ifdef HAVE_LIBIDN - mem_free (&host_idna); + p_delete(&host_idna); # endif if (rc) { @@ -457,7 +456,7 @@ int raw_socket_open (CONNECTION * conn) if ((he = gethostbyname (host_idna)) == NULL) { # ifdef HAVE_LIBIDN - mem_free (&host_idna); + p_delete(&host_idna); # endif mutt_error (_("Could not find the host \"%s\""), conn->account.host); @@ -465,7 +464,7 @@ int raw_socket_open (CONNECTION * conn) } # ifdef HAVE_LIBIDN - mem_free (&host_idna); + p_delete(&host_idna); # endif mutt_message (_("Connecting to %s..."), conn->account.host); @@ -477,6 +476,7 @@ int raw_socket_open (CONNECTION * conn) if (fd >= 0) { if ((rc = socket_connect (fd, (struct sockaddr *) &sin)) == 0) { + fcntl (fd, F_SETFD, FD_CLOEXEC); conn->fd = fd; break; }