]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Crashfix. Memory leak fixes.
authorTimo Sirainen <tss@iki.fi>
Mon, 5 May 2008 22:24:16 +0000 (01:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 5 May 2008 22:24:16 +0000 (01:24 +0300)
--HG--
branch : HEAD

src/imap/imap-thread-finish.c
src/imap/imap-thread.c

index 2dd0f208dab47298c825038a44d49a44bfae9bbb..9b04fc709af09462f286d9b053fe919c361e6c29 100644 (file)
@@ -339,7 +339,6 @@ static void mail_thread_root_thread_merge(struct thread_finish_context *ctx,
                new_root.root_idx1 = array_count(&ctx->roots) + 1;
                new_root.node.idx = ctx->next_new_root_idx++;
                new_root.dummy = TRUE;
-               array_append(&ctx->roots, &new_root, 1);
 
                thread_add_shadow_child(ctx, new_root.node.idx, root->node.idx);
                thread_add_shadow_child(ctx, new_root.node.idx, cur->node.idx);
@@ -348,6 +347,9 @@ static void mail_thread_root_thread_merge(struct thread_finish_context *ctx,
                root->ignore = TRUE;
                cur->ignore = TRUE;
 
+               /* append last, since it breaks root and cur pointers */
+               array_append(&ctx->roots, &new_root, 1);
+
                /* make sure all shadow indexes are accessible directly */
                (void)array_idx_modifiable(&ctx->shadow_nodes,
                                           new_root.node.idx);
@@ -670,5 +672,7 @@ int mail_thread_finish(struct mail *tmp_mail,
        T_BEGIN {
                ret = send_roots(&ctx);
        } T_END;
+       array_free(&ctx.roots);
+       array_free(&ctx.shadow_nodes);
        return ret;
 }
index 23f4e69b999b446a9c46f6edd26d6c3004fa88e6..79113cc8e6aa24f00ff2d243ee3655a813ab751b 100644 (file)
@@ -351,6 +351,8 @@ static int imap_thread_finish(struct imap_thread_mailbox *tbox,
 {
        int ret;
 
+       mail_hash_transaction_end(&ctx->thread_ctx.hash_trans);
+
        ret = mailbox_search_deinit(&ctx->search);
        mail_free(&ctx->thread_ctx.tmp_mail);
        if (mailbox_transaction_commit(&ctx->t) < 0)