aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-08-07 08:38:52 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-08-07 08:38:52 +0000
commitc37b5d80dcbc0b30427ac7671b9eccd8856b1579 (patch)
treefce7689e312b4747523da39ab5975dc0d90b6bb0 /driver.c
parent00428859b66df7161ee4a0d3f55afaa03aa7a2c3 (diff)
downloadfetchmail-c37b5d80dcbc0b30427ac7671b9eccd8856b1579.tar.gz
fetchmail-c37b5d80dcbc0b30427ac7671b9eccd8856b1579.tar.bz2
fetchmail-c37b5d80dcbc0b30427ac7671b9eccd8856b1579.zip
Freeaddrinfo() fix for Uli Zappe's bug.
This might fix Debian Bug#294547 and Bug#377135. svn path=/branches/BRANCH_6-3/; revision=4880
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c12
1 files changed, 11 insertions, 1 deletions
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;