The branch, master has been updated via 085542f lib: poll_funcs : poll_funcs_context_slot_find can select the wrong slot to replace. via ee64d3f s4/messaging: let the imessaging ctx destructor free msg_dgm_ref via c132b78 lib/poll_funcs: free contexts in poll_funcs_state_destructor() via 5d2ca25 lib/poll_funcs: free timers in poll_funcs_state_destructor() from 4f9d956 s3/smbd: remove a misleading error message
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 085542fc93b3c603e8cda6e481e94d5fe2dfc669 Author: Jeremy Allison <j...@samba.org> Date: Fri Sep 16 23:37:20 2016 -0700 lib: poll_funcs : poll_funcs_context_slot_find can select the wrong slot to replace. Look for an exact match first, before a free slot. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12272 Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Sep 19 07:12:00 CEST 2016 on sn-devel-144 commit ee64d3f1d89a3ceb61d035e776c8235a19c8a2cf Author: Ralph Boehme <s...@samba.org> Date: Thu Sep 15 14:19:51 2016 +0200 s4/messaging: let the imessaging ctx destructor free msg_dgm_ref BUG: https://bugzilla.samba.org/show_bug.cgi?id=12272 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c132b78c484c14d255a98567e90b934b73ebf8c2 Author: Ralph Boehme <s...@samba.org> Date: Fri Sep 16 17:55:56 2016 +0200 lib/poll_funcs: free contexts in poll_funcs_state_destructor() This ensures the destructors get called in the proper order. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12272 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5d2ca258662330f44b93bc83af208d203a115b1b Author: Ralph Boehme <s...@samba.org> Date: Thu Sep 15 14:19:27 2016 +0200 lib/poll_funcs: free timers in poll_funcs_state_destructor() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12272 Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/poll_funcs/poll_funcs_tevent.c | 21 ++++++++++++++++++++- source4/lib/messaging/messaging.c | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) Changeset truncated at 500 lines: diff --git a/lib/poll_funcs/poll_funcs_tevent.c b/lib/poll_funcs/poll_funcs_tevent.c index 3059ebc..4dd09a2 100644 --- a/lib/poll_funcs/poll_funcs_tevent.c +++ b/lib/poll_funcs/poll_funcs_tevent.c @@ -474,6 +474,8 @@ struct poll_funcs *poll_funcs_init_tevent(TALLOC_CTX *mem_ctx) static int poll_funcs_state_destructor(struct poll_funcs_state *state) { size_t num_watches = talloc_array_length(state->watches); + size_t num_timeouts = talloc_array_length(state->timeouts); + size_t num_contexts = talloc_array_length(state->contexts); size_t i; /* * Make sure the watches are cleared before the contexts. The watches @@ -482,6 +484,12 @@ static int poll_funcs_state_destructor(struct poll_funcs_state *state) for (i=0; i<num_watches; i++) { TALLOC_FREE(state->watches[i]); } + for (i=0; i<num_timeouts; i++) { + TALLOC_FREE(state->timeouts[i]); + } + for (i=0; i<num_contexts; i++) { + TALLOC_FREE(state->contexts[i]); + } return 0; } @@ -496,10 +504,21 @@ static bool poll_funcs_context_slot_find(struct poll_funcs_state *state, size_t num_contexts = talloc_array_length(state->contexts); size_t i; + /* Look for an existing match first. */ + for (i=0; i<num_contexts; i++) { + struct poll_funcs_tevent_context *ctx = state->contexts[i]; + + if (ctx != NULL && ctx->ev == ev) { + *slot = i; + return true; + } + } + + /* Now look for a free slot. */ for (i=0; i<num_contexts; i++) { struct poll_funcs_tevent_context *ctx = state->contexts[i]; - if ((ctx == NULL) || (ctx->ev == ev)) { + if (ctx == NULL) { *slot = i; return true; } diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index ea50627..d0beef6 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -304,6 +304,7 @@ static struct imessaging_context *msg_ctxs; static int imessaging_context_destructor(struct imessaging_context *msg) { DLIST_REMOVE(msg_ctxs, msg); + TALLOC_FREE(msg->msg_dgm_ref); return 0; } -- Samba Shared Repository