deinit() can be called even if init() was never called.
{
struct status_cmd_context *ctx = (struct status_cmd_context *)_ctx;
- mail_search_args_unref(&ctx->search_args);
+ if (ctx->search_args != NULL)
+ mail_search_args_unref(&ctx->search_args);
}
static bool
{
struct list_cmd_context *ctx = (struct list_cmd_context *)_ctx;
- mail_search_args_unref(&ctx->search_args);
+ if (ctx->search_args != NULL)
+ mail_search_args_unref(&ctx->search_args);
}
static struct doveadm_mail_cmd_context *cmd_mailbox_list_alloc(void)
command. This is called once per each user. */
int (*run)(struct doveadm_mail_cmd_context *ctx,
struct mail_user *mail_user);
- /* Deinitialize the command. Called once at the end. */
+ /* Deinitialize the command. Called once at the end - even if
+ preinit() or init() was never called. */
void (*deinit)(struct doveadm_mail_cmd_context *ctx);
};