aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-09-26 15:26:32 +0000
committerEric S. Raymond <esr@thyrsus.com>2000-09-26 15:26:32 +0000
commit7ca66ea279237adce7f1730bed5866bca111b1ed (patch)
tree121904cfdd660e0ba57b2da685cc202fc83516c9
parent1c7ab650bf7acfdd94ee386c84dccc8d5cb157b6 (diff)
downloadfetchmail-7ca66ea279237adce7f1730bed5866bca111b1ed.tar.gz
fetchmail-7ca66ea279237adce7f1730bed5866bca111b1ed.tar.bz2
fetchmail-7ca66ea279237adce7f1730bed5866bca111b1ed.zip
Avoid a coredump.
svn path=/trunk/; revision=2968
-rw-r--r--driver.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/driver.c b/driver.c
index c9ac0d23..3582bae3 100644
--- a/driver.c
+++ b/driver.c
@@ -448,6 +448,16 @@ static int readheaders(int sock,
/* read message headers */
msgblk.reallen = reallen;
+
+ /*
+ * We used to free the header block unconditionally at the end of
+ * readheaders, but it turns out that if close_sink() hits an error
+ * condition the code for sending bouncemail will actually look
+ * at the freed storage and coredump...
+ */
+ if (msgblk.headers)
+ free(msgblk.headers);
+
msgblk.headers = received_for = NULL;
from_offs = reply_to_offs = resent_from_offs = app_from_offs =
sender_offs = resent_sender_offs = env_offs = -1;
@@ -1151,7 +1161,7 @@ static int readheaders(int sock,
*cp++ = '\0';
stuffline(ctl, buf);
- free(msgblk.headers);
+/* free(msgblk.headers); */
free_str_list(&msgblk.recipients);
return(headers_ok ? PS_SUCCESS : PS_TRUNCATED);
}