dovecot-2.0: quota: Fixed a potential crash with dict quota at d...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 28 15:19:27 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/3de690764509
changeset: 11641:3de690764509
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 28 13:19:24 2010 +0100
description:
quota: Fixed a potential crash with dict quota at deinit.

diffstat:

 src/plugins/quota/quota.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r a1daaaa5d1f5 -r 3de690764509 src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Mon Jun 28 13:08:51 2010 +0100
+++ b/src/plugins/quota/quota.c	Mon Jun 28 13:19:24 2010 +0100
@@ -282,11 +282,13 @@
 	struct quota_root *const *roots;
 	unsigned int i, count;
 
-	*_quota = NULL;
-
 	roots = array_get(&quota->roots, &count);
 	for (i = 0; i < count; i++)
 		quota_root_deinit(roots[i]);
+
+	/* deinit quota roots before setting quser->quota=NULL */
+	*_quota = NULL;
+
 	array_free(&quota->roots);
 	array_free(&quota->namespaces);
 	i_free(quota);
@@ -839,6 +841,8 @@
 	ctx->quota = box->list->ns->owner != NULL ?
 		quota_get_mail_user_quota(box->list->ns->owner) :
 		quota_get_mail_user_quota(box->list->ns->user);
+	i_assert(ctx->quota != NULL);
+
 	ctx->box = box;
 	ctx->bytes_left = (uint64_t)-1;
 	ctx->count_left = (uint64_t)-1;


More information about the dovecot-cvs mailing list