From 91e2dc36b9c0c91f0af716be81dc2aa6cbbed6c2 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 20 Jul 2010 15:18:16 +0100 Subject: [PATCH] auth: Fixed a crash on cancelled userdb iteration. --- src/auth/userdb-blocking.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/auth/userdb-blocking.c b/src/auth/userdb-blocking.c index fd81179d7b..b5026bd956 100644 --- a/src/auth/userdb-blocking.c +++ b/src/auth/userdb-blocking.c @@ -13,6 +13,7 @@ struct blocking_userdb_iterate_context { pool_t pool; struct auth_worker_connection *conn; bool next; + bool destroyed; }; static bool user_callback(const char *reply, void *context) @@ -75,7 +76,8 @@ static bool iter_callback(const char *reply, void *context) if (strcmp(reply, "OK") != 0) ctx->ctx.failed = TRUE; - ctx->ctx.callback(NULL, ctx->ctx.context); + if (!ctx->destroyed) + ctx->ctx.callback(NULL, ctx->ctx.context); pool_unref(&pool); return TRUE; } @@ -120,6 +122,8 @@ int userdb_blocking_iter_deinit(struct userdb_iterate_context **_ctx) int ret = ctx->ctx.failed ? -1 : 0; *_ctx = NULL; + + ctx->destroyed = TRUE; pool_unref(&ctx->pool); return ret; } -- 2.47.3