dovecot-1.2: Changed mail_user refcounting to fix deinitialization.

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 21 21:19:19 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/ae30ea8532ee
changeset: 8472:ae30ea8532ee
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 21 21:19:16 2008 +0200
description:
Changed mail_user refcounting to fix deinitialization.

diffstat:

1 file changed, 1 insertion(+), 4 deletions(-)
src/lib-storage/mail-namespace.c |    5 +----

diffs (36 lines):

diff -r f82ba0d5ed30 -r ae30ea8532ee src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c	Fri Nov 21 19:56:42 2008 +0200
+++ b/src/lib-storage/mail-namespace.c	Fri Nov 21 21:19:16 2008 +0200
@@ -29,7 +29,7 @@ void mail_namespace_init_storage(struct 
 
 static void mail_namespace_free(struct mail_namespace *ns)
 {
-	if (ns->owner != NULL)
+	if (ns->owner != ns->user && ns->owner != NULL)
 		mail_user_unref(&ns->owner);
 	i_free(ns->prefix);
 	i_free(ns);
@@ -65,7 +65,6 @@ namespace_add_env(const char *data, unsi
 	if (type == NULL || *type == '\0' || strncmp(type, "private", 7) == 0) {
 		ns->type = NAMESPACE_PRIVATE;
 		ns->owner = user;
-		mail_user_ref(ns->owner);
 	} else if (strncmp(type, "shared", 6) == 0)
 		ns->type = NAMESPACE_SHARED;
 	else if (strncmp(type, "public", 6) == 0)
@@ -252,7 +251,6 @@ int mail_namespaces_init(struct mail_use
 	ns->prefix = i_strdup("");
 	ns->user = user;
 	ns->owner = user;
-	mail_user_ref(ns->owner);
 
 	if (mail_storage_create(ns, NULL, mail, flags, lock_method,
 				&error) < 0) {
@@ -283,7 +281,6 @@ mail_namespaces_init_empty(struct mail_u
 	ns = i_new(struct mail_namespace, 1);
 	ns->user = user;
 	ns->owner = user;
-	mail_user_ref(ns->owner);
 	ns->prefix = i_strdup("");
 	ns->flags = NAMESPACE_FLAG_INBOX | NAMESPACE_FLAG_LIST_PREFIX |
 		NAMESPACE_FLAG_SUBSCRIPTIONS;


More information about the dovecot-cvs mailing list