dovecot-2.0: auth: More async auth request deinit fixing.

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 7 21:52:03 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/68287c257c0a
changeset: 11494:68287c257c0a
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 07 19:51:59 2010 +0100
description:
auth: More async auth request deinit fixing.

diffstat:

 src/auth/auth-request-handler.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r cf496a6d669e -r 68287c257c0a src/auth/auth-request-handler.c
--- a/src/auth/auth-request-handler.c	Mon Jun 07 19:31:08 2010 +0100
+++ b/src/auth/auth-request-handler.c	Mon Jun 07 19:51:59 2010 +0100
@@ -62,12 +62,24 @@
 static void auth_request_handler_unref(struct auth_request_handler **_handler)
 {
         struct auth_request_handler *handler = *_handler;
+	struct hash_iterate_context *iter;
+	void *key, *value;
 
 	*_handler = NULL;
 	i_assert(handler->refcount > 0);
 	if (--handler->refcount > 0)
 		return;
 
+	iter = hash_table_iterate_init(handler->requests);
+	while (hash_table_iterate(iter, &key, &value)) {
+		struct auth_request *auth_request = value;
+
+		auth_request->destroyed = TRUE;
+		auth_request_unref(&auth_request);
+	}
+	hash_table_iterate_deinit(&iter);
+	hash_table_clear(handler->requests, TRUE);
+
 	/* notify parent that we're done with all requests */
 	handler->callback(NULL, handler->context);
 
@@ -86,10 +98,8 @@
 		struct auth_request *auth_request = value;
 
 		auth_request->destroyed = TRUE;
-		auth_request_unref(&auth_request);
 	}
 	hash_table_iterate_deinit(&iter);
-	hash_table_clear(handler->requests, TRUE);
 }
 
 void auth_request_handler_destroy(struct auth_request_handler **_handler)


More information about the dovecot-cvs mailing list