From 41ecdb63f1b98bdd04838ef0c4371206f81f4269 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 20 Aug 2018 12:51:28 +0300 Subject: [PATCH] lib-index: mail_cache_lookup_headers() - Allow using datastack pool This fixes assert caused by 53712af0e7f357e7279d9ff03831428aae85aa45: Panic: pool_data_stack_realloc(): stack frame changed --- src/lib-index/mail-cache-lookup.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib-index/mail-cache-lookup.c b/src/lib-index/mail-cache-lookup.c index f070dc0756..f68d17e5d5 100644 --- a/src/lib-index/mail-cache-lookup.c +++ b/src/lib-index/mail-cache-lookup.c @@ -599,16 +599,19 @@ int mail_cache_lookup_headers(struct mail_cache_view *view, string_t *dest, uint32_t seq, unsigned int field_idxs[], unsigned int fields_count) { - pool_t pool; + pool_t pool = NULL; int ret; - T_BEGIN { + if (buffer_get_pool(dest)->datastack_pool) + ret = mail_cache_lookup_headers_real(view, dest, seq, + field_idxs, fields_count, + &pool); + else T_BEGIN { ret = mail_cache_lookup_headers_real(view, dest, seq, field_idxs, fields_count, &pool); - if (pool != NULL) - pool_unref(&pool); } T_END; + pool_unref(&pool); return ret; }