aboutsummaryrefslogtreecommitdiffstats
path: root/mailtrain.c
diff options
context:
space:
mode:
authorSteffen Kaiser <skdovecot@smail.inf.fh-bonn-rhein-sieg.de>2008-03-05 14:25:34 +0100
committerJohannes Berg <johannes@sipsolutions.net>2008-03-05 14:25:34 +0100
commit2d179744d79dc67b1bfcb7881ee7854577fbd17c (patch)
treef2a62cbf49faef3b9ff0d23f1440d1705e29e720 /mailtrain.c
parent7de9f5a9c1d62a944ca74e72013e226ee47b5cb4 (diff)
downloaddovecot-antispam-2d179744d79dc67b1bfcb7881ee7854577fbd17c.tar.gz
dovecot-antispam-2d179744d79dc67b1bfcb7881ee7854577fbd17c.tar.xz
dovecot-antispam-2d179744d79dc67b1bfcb7881ee7854577fbd17c.zip
Fix file descriptor leak in mailtrain backend
Diffstat (limited to 'mailtrain.c')
-rw-r--r--mailtrain.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mailtrain.c b/mailtrain.c
index 08f0534..0df0321 100644
--- a/mailtrain.c
+++ b/mailtrain.c
@@ -131,7 +131,7 @@ static int process_tmpdir(struct mailbox_transaction_context *ctx,
buf = t_malloc(20 + ast->tmplen);
- while (cnt > 0) {
+ while (rc == 0 && cnt > 0) {
cnt--;
i_snprintf(buf, 20 + ast->tmplen - 1, "%s/%d",
ast->tmpdir, cnt);
@@ -144,8 +144,9 @@ static int process_tmpdir(struct mailbox_transaction_context *ctx,
"failed to send mail");
debug("run program failed with exit code %d\n", rc);
rc = -1;
- break;
}
+
+ close(fd);
}
t_pop();