]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: fail storage: Allocate event for mailbox.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 20 Jun 2018 10:40:37 +0000 (12:40 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 11 Oct 2018 08:19:44 +0000 (11:19 +0300)
Absence of event causes segfault when event logging is performed for the
mailbox.

src/lib-storage/fail-mailbox.c

index 175cf2bd2009d5ac86ea3df9bc71547cd397c6d3..1b79b240808a6db9595e3359ad816e313976fc19 100644 (file)
@@ -39,8 +39,9 @@ static void fail_mailbox_close(struct mailbox *box ATTR_UNUSED)
 {
 }
 
-static void fail_mailbox_free(struct mailbox *box ATTR_UNUSED)
+static void fail_mailbox_free(struct mailbox *box)
 {
+       event_unref(&box->event);
 }
 
 static int
@@ -322,6 +323,12 @@ fail_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
        box->pool = pool;
        box->flags = flags;
 
+       box->event = event_create(box->storage->event);
+       event_add_category(box->event, &event_category_mailbox);
+       event_add_str(box->event, "name", box->vname);
+       event_set_append_log_prefix(box->event,
+               t_strdup_printf("Mailbox %s: ", box->vname));
+
        p_array_init(&box->search_results, pool, 16);
        p_array_init(&box->module_contexts, pool, 5);
        return box;