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);
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);
T_BEGIN {
ret = send_roots(&ctx);
} T_END;
+ array_free(&ctx.roots);
+ array_free(&ctx.shadow_nodes);
return ret;
}
{
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)