diff --git a/librpc/rpc/dcesrv_core.h b/librpc/rpc/dcesrv_core.h index 24750872b3f..90f5bd21d64 100644 --- a/librpc/rpc/dcesrv_core.h +++ b/librpc/rpc/dcesrv_core.h @@ -647,6 +647,8 @@ _PUBLIC_ NTSTATUS dcesrv_interface_bind_reject_connect(struct dcesrv_connection_ _PUBLIC_ NTSTATUS dcesrv_interface_bind_allow_connect(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface); +_PUBLIC_ void dcesrv_assoc_group_common_destructor(struct dcesrv_assoc_group *assoc_group); + _PUBLIC_ NTSTATUS _dcesrv_iface_state_store_assoc( struct dcesrv_call_state *call, uint64_t magic, diff --git a/librpc/rpc/dcesrv_handles.c b/librpc/rpc/dcesrv_handles.c index b8719d8c804..eff63970e16 100644 --- a/librpc/rpc/dcesrv_handles.c +++ b/librpc/rpc/dcesrv_handles.c @@ -163,10 +163,25 @@ struct dcesrv_iface_state { static int dcesrv_iface_state_destructor(struct dcesrv_iface_state *istate) { - DLIST_REMOVE(istate->assoc->iface_states, istate); + if (istate->assoc != NULL) { + DLIST_REMOVE(istate->assoc->iface_states, istate); + istate->assoc = NULL; + } return 0; } +void dcesrv_assoc_group_common_destructor(struct dcesrv_assoc_group *assoc_group) +{ + struct dcesrv_iface_state *cur = NULL; + struct dcesrv_iface_state *next = NULL; + + for (cur = assoc_group->iface_states; cur != NULL; cur = next) { + next = cur->next; + cur->assoc = NULL; + DLIST_REMOVE(assoc_group->iface_states, cur); + } +} + static void *dcesrv_iface_state_find(struct dcesrv_assoc_group *assoc, const struct dcesrv_interface *iface, const struct dom_sid *owner,