From: Timo Sirainen Date: Sat, 10 Apr 2010 04:25:19 +0000 (+0300) Subject: lmtp: Fixed crash when multiple mails were saved and second one failed. X-Git-Tag: 2.0.beta5~151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d80a44b0aab5f56e6044bd587ac3731c379aaa14;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Fixed crash when multiple mails were saved and second one failed. --HG-- branch : HEAD --- diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index 5cdfafa13a..e8212e4e1c 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -606,13 +606,18 @@ client_input_data_write_local(struct client *client, struct istream *input) /* save the message to the first recipient's mailbox */ src_mail = client->state.raw_mail; - if (!client_deliver_next(client, src_mail)) + if (!client_deliver_next(client, src_mail)) { + /* nothing got saved */ + i_assert(client->state.first_saved_mail == NULL); return; + } if (client->state.first_saved_mail == NULL) mail_user_unref(&client->state.dest_user); - else + else { + client->state.dest_user = NULL; src_mail = client->state.first_saved_mail; + } /* use the first saved message to save it elsewhere too. this might allow hard linking the files. */