From e8912b9ad31154adca4d2065b2986661a956a959 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 24 Mar 2011 13:07:54 +0100 Subject: s3-epmapper: Refactor the cleanup of endpoints. --- source3/rpc_server/epmapper/srv_epmapper.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source3/rpc_server/epmapper/srv_epmapper.c b/source3/rpc_server/epmapper/srv_epmapper.c index 3c12b3caa2..2e3e5d2173 100644 --- a/source3/rpc_server/epmapper/srv_epmapper.c +++ b/source3/rpc_server/epmapper/srv_epmapper.c @@ -231,16 +231,12 @@ static bool is_priviledged_pipe(struct auth_serversupplied_info *info) { bool srv_epmapper_delete_endpoints(struct pipes_struct *p) { struct epm_Delete r; - struct dcesrv_ep_entry_list *el; + struct dcesrv_ep_entry_list *el = p->ep_entries; error_status_t result; - if (p->ep_entries == NULL) { - return true; - } + while (el) { + struct dcesrv_ep_entry_list *next = el->next; - for (el = p->ep_entries; - el != NULL; - el = p->ep_entries) { r.in.num_ents = el->num_ents; r.in.entries = el->entries; @@ -254,6 +250,8 @@ bool srv_epmapper_delete_endpoints(struct pipes_struct *p) DLIST_REMOVE(p->ep_entries, el); TALLOC_FREE(el); + + el = next; } return true; @@ -261,13 +259,15 @@ bool srv_epmapper_delete_endpoints(struct pipes_struct *p) void srv_epmapper_cleanup(void) { - struct dcesrv_endpoint *ep; + struct dcesrv_endpoint *ep = endpoint_table; + + while (ep) { + struct dcesrv_endpoint *next = ep->next; - for (ep = endpoint_table; - ep != NULL; - ep = endpoint_table) { DLIST_REMOVE(endpoint_table, ep); TALLOC_FREE(ep); + + ep = next; } } -- cgit