From: Timo Sirainen Date: Thu, 20 Aug 2015 13:04:48 +0000 (+0300) Subject: imap: Fixed memory leak in SELECT QRESYNC error handling path. X-Git-Tag: 2.2.19.rc1~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef8187766609974091c2e92ed375a4bcfd1d28c3;p=thirdparty%2Fdovecot%2Fcore.git imap: Fixed memory leak in SELECT QRESYNC error handling path. --- diff --git a/src/imap/cmd-select.c b/src/imap/cmd-select.c index 04d61c0cf1..585c36cc7f 100644 --- a/src/imap/cmd-select.c +++ b/src/imap/cmd-select.c @@ -238,6 +238,7 @@ static int select_qresync(struct imap_select_context *ctx) struct imap_fetch_context *fetch_ctx; struct mail_search_args *search_args; struct imap_fetch_qresync_args qresync_args; + int ret; search_args = mail_search_build_init(); search_args->args = p_new(search_args->pool, struct mail_search_arg, 1); @@ -273,10 +274,9 @@ static int select_qresync(struct imap_select_context *ctx) ctx->cmd->context = ctx; return 0; } - if (imap_fetch_end(fetch_ctx) < 0) - return -1; + ret = imap_fetch_end(fetch_ctx); imap_fetch_free(&fetch_ctx); - return 1; + return ret < 0 ? -1 : 1; } static int