Mercurial > dovecot > core-2.2
changeset 11641:3de690764509 HEAD
quota: Fixed a potential crash with dict quota at deinit.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 28 Jun 2010 13:19:24 +0100 |
parents | a1daaaa5d1f5 |
children | 59c952713e94 |
files | src/plugins/quota/quota.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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("a->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("a->roots); array_free("a->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;