Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7022:ebdd050c0a58 HEAD
If mail_get_stream() succeeds but mail_get_*_size() fails, we didn't
reference the stream so we must not unreference it later either.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 22 Dec 2007 02:53:20 +0200 |
parents | c4f4fa03e14e |
children | 56a5a00e490c |
files | src/imap/imap-fetch-body.c |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-fetch-body.c Sat Dec 22 02:52:39 2007 +0200 +++ b/src/imap/imap-fetch-body.c Sat Dec 22 02:53:20 2007 +0200 @@ -323,21 +323,22 @@ const struct imap_fetch_body_data *body) { const struct message_size *fetch_size; + struct istream *input; struct message_size hdr_size, body_size; if (body->section[0] == '\0') { - if (mail_get_stream(mail, NULL, NULL, &ctx->cur_input) < 0) - return -1; - if (mail_get_virtual_size(mail, &body_size.virtual_size) < 0 || + if (mail_get_stream(mail, NULL, NULL, &input) < 0 || + mail_get_virtual_size(mail, &body_size.virtual_size) < 0 || mail_get_physical_size(mail, &body_size.physical_size) < 0) return -1; } else { if (mail_get_stream(mail, &hdr_size, body->section[0] == 'H' ? NULL : &body_size, - &ctx->cur_input) < 0) + &input) < 0) return -1; } + ctx->cur_input = input; i_stream_ref(ctx->cur_input); ctx->update_partial = TRUE; @@ -872,14 +873,14 @@ { struct message_size size; const char *str; + struct istream *input; - if (mail_get_stream(mail, NULL, NULL, &ctx->cur_input) < 0) - return -1; - - if (mail_get_virtual_size(mail, &size.virtual_size) < 0 || + if (mail_get_stream(mail, NULL, NULL, &input) < 0 || + mail_get_virtual_size(mail, &size.virtual_size) < 0 || mail_get_physical_size(mail, &size.physical_size) < 0) return -1; + ctx->cur_input = input; i_stream_ref(ctx->cur_input); ctx->update_partial = FALSE;