From ada5df6950f5ac1697f056368b1b2262f64ec0d1 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 27 Jan 2023 21:59:00 +0200 Subject: [PATCH] lib-storage: shared - Fix handling errors initializing shared mailbox owner user Broken by 46289fd0efce678c07f13bfa5f3cb077d2ea8cb8 --- src/lib-storage/index/shared/shared-storage.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index c0cc33e83e..1eae49cb14 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -275,14 +275,16 @@ int shared_storage_get_namespace(struct mail_namespace **_ns, }; if (mail_storage_service_lookup_next(storage_service, &input, &owner, &error) < 0) { - if (owner != NULL && !owner->nonexistent) { + if (owner == NULL || !owner->nonexistent) { mailbox_list_set_critical(list, "Couldn't create namespace '%s' for user %s: %s", - ns->prefix, owner->username, error); - mail_user_deinit(&owner); + ns->prefix, userdomain, error); + if (owner != NULL) + mail_user_deinit(&owner); io_loop_context_switch(old_ioloop_ctx); return -1; } + /* owner is a nonexistent user */ } owner->creator = user; -- 2.47.3