]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
plugins/fts: Fix memory leak when searching mail in virtual folder with fts.
authorsergey.kitov <sergey.kitov@open-xchange.com>
Mon, 8 Nov 2021 12:36:57 +0000 (14:36 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 9 Nov 2021 18:24:43 +0000 (18:24 +0000)
src/plugins/fts/fts-storage.c

index 8024e20bb1c9a22059f27ae59634d0bb1a71c200..5ecbae58690d87a9f33b0c826b0ddb5cdfee474d 100644 (file)
@@ -825,14 +825,13 @@ static void fts_mailbox_virtual_match_mail(struct mail_search_context *ctx,
                hash_table_lookup(fctx->last_indexed_virtual_uids, box_name);
        if (uid_value == NULL) {
                /* This backend's last indexed uid is not yet inserted to the table */
-               pool_t p = pool_alloconly_create("be mailbox names", 1024);
                if (mailbox_open(backend_mail->box) < 0 ||
                    fts_backend_get_last_uid(fctx->backend, backend_mail->box,
                                             &be_last_uid) < 0) {
                        be_last_uid = 0;
                } else {
                        const char *vname_copy =
-                               p_strdup(p, backend_mail->box->vname);
+                               p_strdup(fctx->result_pool, backend_mail->box->vname);
                        hash_table_insert(hash_tbl, vname_copy,
                                          POINTER_CAST(be_last_uid + 1));
                }