dovecot: Fixed memory leak when FETCH command used multiple stre...

dovecot at dovecot.org dovecot at dovecot.org
Sun Dec 9 16:08:01 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/1029b2ffad2d
changeset: 6979:1029b2ffad2d
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Dec 09 16:07:58 2007 +0200
description:
Fixed memory leak when FETCH command used multiple streams.

diffstat:

1 file changed, 4 insertions(+), 3 deletions(-)
src/imap/imap-fetch.c |    7 ++++---

diffs (31 lines):

diff -r 4fb1b0f43d60 -r 1029b2ffad2d src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c	Sun Dec 09 15:50:24 2007 +0200
+++ b/src/imap/imap-fetch.c	Sun Dec 09 16:07:58 2007 +0200
@@ -261,6 +261,8 @@ int imap_fetch(struct imap_fetch_context
 		ctx->cont_handler = NULL;
 		ctx->cur_offset = 0;
                 ctx->cur_handler++;
+		if (ctx->cur_input != NULL)
+			i_stream_unref(&ctx->cur_input);
 	}
 
 	/* assume initially that we're locking it */
@@ -286,9 +288,6 @@ int imap_fetch(struct imap_fetch_context
 			if (ctx->cmd->cancel)
 				return 1;
 
-			if (ctx->cur_input != NULL)
-				i_stream_unref(&ctx->cur_input);
-
 			if (mailbox_search_next(ctx->search_ctx,
 						ctx->mail) <= 0)
 				break;
@@ -341,6 +340,8 @@ int imap_fetch(struct imap_fetch_context
 
 			ctx->cont_handler = NULL;
 			ctx->cur_offset = 0;
+			if (ctx->cur_input != NULL)
+				i_stream_unref(&ctx->cur_input);
 		}
 
 		if (str_len(ctx->cur_str) > 0) {


More information about the dovecot-cvs mailing list