dovecot-2.2: lib-sasl: Added reference counting to lib-sasl init...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Sep 30 20:50:25 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/4c18abbf8b94
changeset: 17850:4c18abbf8b94
user: Stephan Bosch <stephan at rename-it.nl>
date: Tue Sep 30 23:49:35 2014 +0300
description:
lib-sasl: Added reference counting to lib-sasl initialization.
diffstat:
src/lib-sasl/dsasl-client.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (29 lines):
diff -r 18fc72a4a318 -r 4c18abbf8b94 src/lib-sasl/dsasl-client.c
--- a/src/lib-sasl/dsasl-client.c Mon Sep 29 22:44:03 2014 +0300
+++ b/src/lib-sasl/dsasl-client.c Tue Sep 30 23:49:35 2014 +0300
@@ -5,6 +5,7 @@
#include "safe-memset.h"
#include "dsasl-client-private.h"
+static int init_refcount = 0;
static ARRAY(const struct dsasl_client_mech *) dsasl_mechanisms = ARRAY_INIT;
static const struct dsasl_client_mech *
@@ -93,6 +94,9 @@
void dsasl_clients_init(void)
{
+ if (init_refcount++ > 0)
+ return;
+
i_array_init(&dsasl_mechanisms, 8);
dsasl_client_mech_register(&dsasl_client_mech_plain);
dsasl_client_mech_register(&dsasl_client_mech_login);
@@ -100,5 +104,7 @@
void dsasl_clients_deinit(void)
{
+ if (--init_refcount > 0)
+ return;
array_free(&dsasl_mechanisms);
}
More information about the dovecot-cvs
mailing list