]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: mail_cache_lookup_headers() - Allow using datastack pool
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 20 Aug 2018 09:51:28 +0000 (12:51 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Aug 2018 08:24:59 +0000 (11:24 +0300)
This fixes assert caused by 53712af0e7f357e7279d9ff03831428aae85aa45:
Panic: pool_data_stack_realloc(): stack frame changed

src/lib-index/mail-cache-lookup.c

index f070dc0756e704cc71bc2e7442d6b0e26109772d..f68d17e5d50ab96a8a43ba68fbc83edc3be09448 100644 (file)
@@ -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;
 }