dovecot-1.0: Fixed memory leak when FETCH command used multiple ...

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


details:   http://hg.dovecot.org/dovecot-1.0/rev/78d366768241
changeset: 5484:78d366768241
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Dec 09 16:07:57 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 212777918121 -r 78d366768241 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c	Tue Dec 04 15:14:35 2007 +0200
+++ b/src/imap/imap-fetch.c	Sun Dec 09 16:07:57 2007 +0200
@@ -252,6 +252,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);
 	}
 
 	handlers = array_get(&ctx->handlers, &count);
@@ -264,9 +266,6 @@ int imap_fetch(struct imap_fetch_context
 		}
 
 		if (ctx->cur_mail == NULL) {
-			if (ctx->cur_input != NULL)
-				i_stream_unref(&ctx->cur_input);
-
 			if (mailbox_search_next(ctx->search_ctx,
 						ctx->mail) <= 0)
 				break;
@@ -311,6 +310,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