summaryrefslogtreecommitdiff
path: root/common/spio.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-03-03 19:55:34 +0000
committerStef Walter <stef@memberwebs.com>2005-03-03 19:55:34 +0000
commit06196fa324bb5fa6afcac3ff701c7a8d8ca17544 (patch)
tree3bab4d15615535068bb8815444887693715e1385 /common/spio.c
parent9c84cfe9479062b612f46a9b8d3388c832306686 (diff)
Don't leak file descriptors when clamsmtpd can't connect to outgoing SMTP server [Chris Mason]
Diffstat (limited to 'common/spio.c')
-rw-r--r--common/spio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/spio.c b/common/spio.c
index f43988a..67e0405 100644
--- a/common/spio.c
+++ b/common/spio.c
@@ -155,7 +155,10 @@ int spio_connect(spctx_t* ctx, spio_t* io, const struct sockaddr_any* sany,
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
if(connect(fd, &SANY_ADDR(*sany), SANY_LEN(*sany)) == -1)
+ {
+ close_raw(&fd);
RETURN(-1);
+ }
spio_attach(ctx, io, fd, NULL);