From bb75bc110f36189bf89aafea049142a9b9221eed Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 21 Sep 2021 16:42:39 +0300 Subject: [PATCH] lib-index: Don't use data stack for building index header update buffer The header update can be large (e.g. dovecot.list.index with many mailboxes) and grow data stack unnecessarily. --- src/lib-index/mail-index-transaction-export.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib-index/mail-index-transaction-export.c b/src/lib-index/mail-index-transaction-export.c index 4f903cf8e7..2aced679a3 100644 --- a/src/lib-index/mail-index-transaction-export.c +++ b/src/lib-index/mail-index-transaction-export.c @@ -206,7 +206,7 @@ log_append_ext_hdr_update(struct mail_index_export_context *ctx, data = hdr->data; mask = hdr->mask; - buf = t_buffer_create(256); + buf = buffer_create_dynamic(default_pool, 256); for (offset = 0; offset <= hdr->alloc_size; offset++) { if (offset < hdr->alloc_size && mask[offset] != 0) { if (!started) { @@ -233,6 +233,7 @@ log_append_ext_hdr_update(struct mail_index_export_context *ctx, buffer_append_zero(buf, 4 - buf->used % 4); log_append_buffer(ctx, buf, use_32 ? MAIL_TRANSACTION_EXT_HDR_UPDATE32 : MAIL_TRANSACTION_EXT_HDR_UPDATE); + buffer_free(&buf); } static void -- 2.47.3