summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-03-24 13:07:54 +0100
committerSimo Sorce <idra@samba.org>2011-03-24 14:57:12 -0400
commite8912b9ad31154adca4d2065b2986661a956a959 (patch)
tree8c6f8d97728fc90141e1a3a6975f3d70216dc360
parentfd89e29e7ee5065b6f4349e391c90c5f81e7c476 (diff)
downloadsamba-e8912b9ad31154adca4d2065b2986661a956a959.tar.gz
samba-e8912b9ad31154adca4d2065b2986661a956a959.tar.bz2
samba-e8912b9ad31154adca4d2065b2986661a956a959.zip
s3-epmapper: Refactor the cleanup of endpoints.
-rw-r--r--source3/rpc_server/epmapper/srv_epmapper.c22
1 files 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;
}
}