From c37b5d80dcbc0b30427ac7671b9eccd8856b1579 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Mon, 7 Aug 2006 08:38:52 +0000 Subject: Freeaddrinfo() fix for Uli Zappe's bug. This might fix Debian Bug#294547 and Bug#377135. svn path=/branches/BRANCH_6-3/; revision=4880 --- driver.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 5d765986..c9d3e6a0 100644 --- a/driver.c +++ b/driver.c @@ -70,6 +70,8 @@ int batchcount; /* count of messages sent in current batch */ flag peek_capable; /* can we peek for better error recovery? */ int mailserver_socket_temp = -1; /* socket to free if connect timeout */ +struct addrinfo *ai0, *ai1; /* clean these up after signal */ + static volatile int timeoutcount = 0; /* count consecutive timeouts */ static volatile int idletimeout = 0; /* timeout occured in idle stage? */ @@ -878,6 +880,14 @@ static int do_session( sigfillset(&allsigs); sigprocmask(SIG_UNBLOCK, &allsigs, NULL); #endif /* HAVE_SIGPROCMASK */ + + if (ai0) { + freeaddrinfo(ai0); ai0 = NULL; + } + + if (ai1) { + freeaddrinfo(ai1); ai1 = NULL; + } if (js == THROW_SIGPIPE) { @@ -1053,7 +1063,7 @@ static int do_session( (void)sleep(1); if ((mailserver_socket = SockOpen(realhost, ctl->server.service ? ctl->server.service : ( ctl->use_ssl ? ctl->server.base_protocol->sslservice : ctl->server.base_protocol->service ), - ctl->server.plugin)) == -1) + ctl->server.plugin, &ai0)) == -1) { char errbuf[BUFSIZ]; int err_no = errno; -- cgit v1.2.3