From 6be7da3ee6c3d833fbf5d075bfabd04bda7e5097 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 22 Oct 2014 15:11:43 +0000 Subject: messaging3: Fix running down a messaging_context When you do a talloc_free(msg_ctx), existing waiters can't and don't have to clean up behind themselves properly anymore. The msg_ctx the cleanup function refers to is just gone. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Oct 24 04:01:32 CEST 2014 on sn-devel-104 --- source3/lib/messages.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source3/lib/messages.c b/source3/lib/messages.c index aaaee52e3a..d4c580fdd2 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -267,7 +267,23 @@ static void messaging_recv_cb(const uint8_t *msg, size_t msg_len, static int messaging_context_destructor(struct messaging_context *ctx) { + unsigned i; + messaging_dgm_destroy(); + + for (i=0; inum_new_waiters; i++) { + if (ctx->new_waiters[i] != NULL) { + tevent_req_set_cleanup_fn(ctx->new_waiters[i], NULL); + ctx->new_waiters[i] = NULL; + } + } + for (i=0; inum_waiters; i++) { + if (ctx->waiters[i] != NULL) { + tevent_req_set_cleanup_fn(ctx->waiters[i], NULL); + ctx->waiters[i] = NULL; + } + } + return 0; } -- cgit