return ret < 0;
ctx = imap_fetch_init(cmd, client->mailbox);
- if (ctx == NULL)
+ if (ctx == NULL) {
+ mail_search_args_unref(&search_args);
return TRUE;
+ }
ctx->search_args = search_args;
if (!fetch_parse_args(ctx, &args[1]) ||
if (ctx->mail != NULL)
mail_free(&ctx->mail);
+ mail_search_args_unref(&ctx->search_args);
if (ctx->search_ctx != NULL) {
if (mailbox_search_deinit(&ctx->search_ctx) < 0)
ctx->failed = TRUE;
metadata = array_get_modifiable(&mmap->metadata_modseqs, &count);
for (i = 0; i < count; i++) {
- if (array_is_created(&metadata->modseqs))
- array_free(&metadata->modseqs);
+ if (array_is_created(&metadata[i].modseqs))
+ array_free(&metadata[i].modseqs);
}
array_free(&mmap->metadata_modseqs);
i_free(mmap);
qsort(nodes, count, sizeof(struct mail_sort_node),
sort_node_cmp);
- i_array_init(&program->seqs, count);
+ if (!array_is_created(&program->seqs))
+ i_array_init(&program->seqs, count);
+ else
+ array_clear(&program->seqs);
for (i = 0; i < count; i++) {
seq = nodes[i].seq;
array_append(&program->seqs, &seq, 1);
}
array_free(&ctx->zero_nodes);
+ i_free(ctx);
+ program->context = NULL;
}
struct mail_search_sort_program *program = *_program;
*_program = NULL;
+
+ if (program->context != NULL)
+ index_sort_list_finish(program);
mail_free(&program->temp_mail);
array_free(&program->seqs);
i_free(program);