# HG changeset patch # User Timo Sirainen # Date 1043131352 -7200 # Node ID ab4091b2ddc272975cb289ebac17ce44c88f59e6 # Parent cba414845f1b8cfc79fd8499fcae812e2eb83f6c FETCH ate too much memory diff -r cba414845f1b -r ab4091b2ddc2 src/imap/imap-fetch.c --- a/src/imap/imap-fetch.c Tue Jan 21 08:05:37 2003 +0200 +++ b/src/imap/imap-fetch.c Tue Jan 21 08:42:32 2003 +0200 @@ -168,6 +168,8 @@ size_t len, orig_len; int failed, data_written; + t_push(); + str_truncate(ctx->str, 0); str_printfa(ctx->str, "* %u FETCH (", mail->seq); orig_len = str_len(ctx->str); @@ -179,17 +181,23 @@ if (ctx->imap_data & IMAP_FETCH_UID) fetch_uid(ctx, mail); if ((ctx->fetch_data & MAIL_FETCH_FLAGS) || mail->seen_updated) - fetch_flags(ctx, mail); + if (!fetch_flags(ctx, mail)) + break; if (ctx->fetch_data & MAIL_FETCH_RECEIVED_DATE) - fetch_internaldate(ctx, mail); + if (!fetch_internaldate(ctx, mail)) + break; if (ctx->fetch_data & MAIL_FETCH_SIZE) - fetch_rfc822_size(ctx, mail); + if (!fetch_rfc822_size(ctx, mail)) + break; if (ctx->fetch_data & MAIL_FETCH_IMAP_BODY) - fetch_body(ctx, mail); + if (!fetch_body(ctx, mail)) + break; if (ctx->fetch_data & MAIL_FETCH_IMAP_BODYSTRUCTURE) - fetch_bodystructure(ctx, mail); + if (!fetch_bodystructure(ctx, mail)) + break; if (ctx->fetch_data & MAIL_FETCH_IMAP_ENVELOPE) - fetch_envelope(ctx, mail); + if(!fetch_envelope(ctx, mail)) + break; /* send the data written into temp string */ len = str_len(ctx->str); @@ -226,6 +234,7 @@ failed = TRUE; } + t_pop(); return !failed; } @@ -261,7 +270,7 @@ ctx.bodies = bodies; ctx.output = client->output; ctx.select_counter = client->select_counter; - ctx.str = t_str_new(8192); + ctx.str = str_new(default_pool, 8192); ctx.fetch_ctx = client->mailbox-> fetch_init(client->mailbox, fetch_data, &update_seen,