summaryrefslogtreecommitdiffstats
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-22 15:11:43 +0000
committerJeremy Allison <jra@samba.org>2014-10-24 04:01:32 +0200
commit6be7da3ee6c3d833fbf5d075bfabd04bda7e5097 (patch)
tree916d65717b213bead0956be9d0c07e9058cfc081 /source3/lib/messages.c
parentc9cced03224011ad25f5fc6b7d737fb2cabd3153 (diff)
downloadsamba-6be7da3ee6c3d833fbf5d075bfabd04bda7e5097.tar.gz
samba-6be7da3ee6c3d833fbf5d075bfabd04bda7e5097.tar.xz
samba-6be7da3ee6c3d833fbf5d075bfabd04bda7e5097.zip
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 <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Oct 24 04:01:32 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c16
1 files changed, 16 insertions, 0 deletions
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; i<ctx->num_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; i<ctx->num_waiters; i++) {
+ if (ctx->waiters[i] != NULL) {
+ tevent_req_set_cleanup_fn(ctx->waiters[i], NULL);
+ ctx->waiters[i] = NULL;
+ }
+ }
+
return 0;
}