From: Timo Sirainen Date: Mon, 25 Apr 2016 09:07:25 +0000 (+0300) Subject: imapc: Fixed crash caused by pool_unref() API change. X-Git-Tag: 2.3.0.rc1~3952 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b540a53c8ac2f5d012149d39cf43a3868c927028;p=thirdparty%2Fdovecot%2Fcore.git imapc: Fixed crash caused by pool_unref() API change. Calling pool_unref() set the mail_private->pool=NULL, which crashed in index_mail_free(). Fixed this by removing the unnecessary ref/unref entirely. We're already waiting in imapc_mail_close() for all the existing FETCHes to finish, so the callback will always have only valid mails with valid pools. --- diff --git a/src/lib-storage/index/imapc/imapc-mail-fetch.c b/src/lib-storage/index/imapc/imapc-mail-fetch.c index 6a0348285d..36a7bb255d 100644 --- a/src/lib-storage/index/imapc/imapc-mail-fetch.c +++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c @@ -67,7 +67,6 @@ imapc_mail_fetch_callback(const struct imapc_command_reply *reply, imapc_mail_set_failure(mail, reply); if (--mail->fetch_count == 0) mail->fetching_fields = 0; - pool_unref(&mail->imail.mail.pool); mbox = (struct imapc_mailbox *)mail->imail.mail.mail.box; } i_assert(mbox != NULL); @@ -285,7 +284,6 @@ imapc_mail_send_fetch(struct mail *_mail, enum mail_fetch_field fields, str_truncate(str, str_len(str)-1); str_append_c(str, ')'); - pool_ref(mail->imail.mail.pool); mail->fetching_fields |= fields; mail->fetch_count++; mail->fetch_sent = FALSE; diff --git a/src/lib-storage/index/imapc/imapc-mail.c b/src/lib-storage/index/imapc/imapc-mail.c index 45be11e3a0..45eb058128 100644 --- a/src/lib-storage/index/imapc/imapc-mail.c +++ b/src/lib-storage/index/imapc/imapc-mail.c @@ -443,6 +443,8 @@ static void imapc_mail_close(struct mail *_mail) buffer_free(&mail->body); mail->header_fetched = FALSE; mail->body_fetched = FALSE; + + i_assert(mail->fetch_count == 0); } static int imapc_mail_get_hdr_hash(struct index_mail *imail)