summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sendmail
diff options
context:
space:
mode:
authorjbeck <none@none>2007-06-20 15:41:54 -0700
committerjbeck <none@none>2007-06-20 15:41:54 -0700
commit7cdcb8abb9b4700219e82028dac3d78699314b6d (patch)
tree25f25cf56cb5891f4cf0f6f837456f2ccb2bf5dc /usr/src/cmd/sendmail
parent6a42cb7b9d730ae02bbdb8898dc074179f96e178 (diff)
downloadillumos-joyent-7cdcb8abb9b4700219e82028dac3d78699314b6d.tar.gz
6568603 mail.local leaks memory
Diffstat (limited to 'usr/src/cmd/sendmail')
-rw-r--r--usr/src/cmd/sendmail/aux/mail.local.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr/src/cmd/sendmail/aux/mail.local.c b/usr/src/cmd/sendmail/aux/mail.local.c
index 8fdf15e33c..98f4fb6636 100644
--- a/usr/src/cmd/sendmail/aux/mail.local.c
+++ b/usr/src/cmd/sendmail/aux/mail.local.c
@@ -9,7 +9,7 @@
*/
/*
- * Copyright 1994-2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1994-2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -531,6 +531,7 @@ store(from, lmtprcpts)
FILE *bfp, *hfp;
char *btn, *htn;
int in_header_section;
+ int newfd;
bfd = -1;
hfd = -1;
@@ -700,6 +701,14 @@ store(from, lmtprcpts)
}
}
+ if ((newfd = dup(bfd)) >= 0) {
+ fclose(bfp);
+ bfd = newfd;
+ }
+ if ((newfd = dup(hfd)) >= 0) {
+ fclose(hfp);
+ hfd = newfd;
+ }
(void) time(&tval);
(void) snprintf(unix_from_line, sizeof (unix_from_line), "From %s %s",
from, ctime(&tval));