Skip to content

Commit

Permalink
doveadm: Make sure all mail storage hooks are freed at deinit.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Jan 22, 2016
1 parent 5b63d2b commit 82130fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/doveadm/doveadm-mail.c
Expand Up @@ -17,6 +17,7 @@
#include "mail-storage.h"
#include "mail-storage-settings.h"
#include "mail-storage-service.h"
#include "mail-storage-hooks.h"
#include "mail-search-build.h"
#include "mail-search-parser.h"
#include "mailbox-list-iter.h"
Expand Down Expand Up @@ -843,5 +844,6 @@ void doveadm_mail_init(void)

void doveadm_mail_deinit(void)
{
mail_storage_hooks_deinit();
array_free(&doveadm_mail_cmds);
}
10 changes: 8 additions & 2 deletions src/lib-storage/mail-storage-hooks.c
Expand Up @@ -49,8 +49,14 @@ void mail_storage_hooks_init(void)

void mail_storage_hooks_deinit(void)
{
array_free(&internal_hooks);
array_free(&module_hooks);
/* allow calling this even if mail_storage_hooks_init() hasn't been
called, because e.g. doveadm plugins could call
mail_storage_hooks_add() even though mail storage is never
initialized. */
if (array_is_created(&internal_hooks))
array_free(&internal_hooks);
if (array_is_created(&module_hooks))
array_free(&module_hooks);
}

void mail_storage_hooks_add(struct module *module,
Expand Down

0 comments on commit 82130fe

Please sign in to comment.