changeset 12287:d44e64390bdd

lmtp: Don't access freed memory if input couldn't be opened as raw mail. This shouldn't really have ever happened.
author Timo Sirainen <tss@iki.fi>
date Sat, 16 Oct 2010 00:21:35 +0100
parents 0d689c112c6e
children cc81de55245f
files src/lmtp/commands.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lmtp/commands.c	Fri Oct 15 19:50:51 2010 +0100
+++ b/src/lmtp/commands.c	Sat Oct 16 00:21:35 2010 +0100
@@ -574,10 +574,9 @@
 	struct mailbox_header_lookup_ctx *headers_ctx;
 	enum mail_error error;
 
-	client->state.raw_box = box =
-		mailbox_alloc(client->raw_mail_user->namespaces->list,
-			      "Dovecot Delivery Mail",
-			      MAILBOX_FLAG_NO_INDEX_FILES);
+	box = mailbox_alloc(client->raw_mail_user->namespaces->list,
+			    "Dovecot Delivery Mail",
+			    MAILBOX_FLAG_NO_INDEX_FILES);
 	if (mailbox_open_stream(box, input) < 0 ||
 	    mailbox_sync(box, 0) < 0) {
 		i_error("Can't open delivery mail as raw: %s",
@@ -589,6 +588,7 @@
 	raw_box = (struct raw_mailbox *)box;
 	raw_box->envelope_sender = client->state.mail_from;
 
+	client->state.raw_box = box;
 	client->state.raw_trans = mailbox_transaction_begin(box, 0);
 
 	headers_ctx = mailbox_header_lookup_init(box, wanted_headers);