rpcrt4: Free the memory for a registered interface that is in use and when WaitForCallsToComplete is 0.

This commit is contained in:
Rob Shearman 2008-09-12 12:58:19 +01:00 committed by Alexandre Julliard
parent be3c3a5214
commit 8cc3adea52
2 changed files with 6 additions and 2 deletions

View file

@ -147,10 +147,11 @@ static RpcServerInterface* RPCRT4_find_interface(UUID* object,
static void RPCRT4_release_server_interface(RpcServerInterface *sif)
{
if (!InterlockedDecrement(&sif->CurrentCalls) &&
sif->CallsCompletedEvent) {
sif->Delete) {
/* sif must have been removed from server_interfaces before
* CallsCompletedEvent is set */
SetEvent(sif->CallsCompletedEvent);
if (sif->CallsCompletedEvent)
SetEvent(sif->CallsCompletedEvent);
HeapFree(GetProcessHeap(), 0, sif);
}
}
@ -888,8 +889,10 @@ RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid
if ((!IfSpec || !memcmp(&If->InterfaceId, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER))) &&
UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) {
list_remove(&cif->entry);
TRACE("unregistering cif %p\n", cif);
if (cif->CurrentCalls) {
completed = FALSE;
cif->Delete = TRUE;
if (WaitForCallsToComplete)
cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL);
}

View file

@ -73,6 +73,7 @@ typedef struct _RpcServerInterface
/* set when unregistering interface to let the caller of
* RpcServerUnregisterIf* know that all calls have finished */
HANDLE CallsCompletedEvent;
BOOL Delete; /* delete when the last call finishes */
} RpcServerInterface;
void RPCRT4_new_client(RpcConnection* conn);