dovecot-2.1: lib-storage: Fixed assert-crash in user deinit with...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Dec 8 06:11:20 EET 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/3b70254e0596
changeset: 13820:3b70254e0596
user: Timo Sirainen <tss at iki.fi>
date: Thu Dec 08 06:11:03 2011 +0200
description:
lib-storage: Fixed assert-crash in user deinit with some installations.
diffstat:
src/lib-storage/mail-user.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r d9ad41825a34 -r 3b70254e0596 src/lib-storage/mail-user.c
--- a/src/lib-storage/mail-user.c Thu Dec 08 05:55:19 2011 +0200
+++ b/src/lib-storage/mail-user.c Thu Dec 08 06:11:03 2011 +0200
@@ -26,7 +26,6 @@
static void mail_user_deinit_base(struct mail_user *user)
{
mail_namespaces_deinit(&user->namespaces);
- pool_unref(&user->pool);
}
struct mail_user *mail_user_alloc(const char *username,
@@ -137,8 +136,16 @@
i_assert(user->refcount > 0);
*_user = NULL;
- if (--user->refcount == 0)
- user->v.deinit(user);
+ if (user->refcount > 1) {
+ user->refcount--;
+ return;
+ }
+
+ /* call deinit() with refcount=1, otherwise we may assert-crash in
+ mail_user_ref() that is called by some deinit() handler. */
+ user->v.deinit(user);
+ i_assert(user->refcount == 1);
+ pool_unref(&user->pool);
}
struct mail_user *mail_user_find(struct mail_user *user, const char *name)
More information about the dovecot-cvs
mailing list