changeset 6257:2618805b3d94 HEAD

If FETCH failed internally, we could have sent broken output (")" lines).
author Timo Sirainen <tss@iki.fi>
date Fri, 10 Aug 2007 14:30:03 +0300
parents 0c9b6ff6fb0b
children 63b744cb99a4
files src/imap/imap-fetch.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-fetch.c	Thu Aug 09 22:25:14 2007 +0300
+++ b/src/imap/imap-fetch.c	Fri Aug 10 14:30:03 2007 +0300
@@ -367,12 +367,13 @@
 			handlers[i].handler(ctx, NULL, handlers[i].context);
 	}
 
-	str_free(&ctx->cur_str);
-
 	if (!ctx->line_finished) {
+		if (imap_fetch_flush_buffer(ctx) < 0)
+			return -1;
 		if (o_stream_send(ctx->client->output, ")\r\n", 3) < 0)
 			ctx->failed = TRUE;
 	}
+	str_free(&ctx->cur_str);
 
 	if (ctx->cur_input != NULL)
 		i_stream_unref(&ctx->cur_input);