view src/imap/cmd-unselect.c @ 3879:928229f8b3e6 HEAD

deinit, unref, destroy, close, free, etc. functions now take a pointer to their data pointer, and set it to NULL. This makes double-frees less likely to cause security holes.
author Timo Sirainen <tss@iki.fi>
date Sat, 14 Jan 2006 20:47:20 +0200
parents 55df57c028d4
children 65c69a53a7be
line wrap: on
line source

/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

bool cmd_unselect(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	client->mailbox = NULL;

	storage = mailbox_get_storage(mailbox);
	if (mailbox_close(&mailbox) < 0)
		client_send_untagged_storage_error(client, storage);

	client_send_tagline(cmd, "OK Unselect completed.");
	return TRUE;
}