Commit 8cc3adea authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

rpcrt4: Free the memory for a registered interface that is in use and when…

rpcrt4: Free the memory for a registered interface that is in use and when WaitForCallsToComplete is 0.
parent be3c3a52
...@@ -147,10 +147,11 @@ static RpcServerInterface* RPCRT4_find_interface(UUID* object, ...@@ -147,10 +147,11 @@ static RpcServerInterface* RPCRT4_find_interface(UUID* object,
static void RPCRT4_release_server_interface(RpcServerInterface *sif) static void RPCRT4_release_server_interface(RpcServerInterface *sif)
{ {
if (!InterlockedDecrement(&sif->CurrentCalls) && if (!InterlockedDecrement(&sif->CurrentCalls) &&
sif->CallsCompletedEvent) { sif->Delete) {
/* sif must have been removed from server_interfaces before /* sif must have been removed from server_interfaces before
* CallsCompletedEvent is set */ * CallsCompletedEvent is set */
SetEvent(sif->CallsCompletedEvent); if (sif->CallsCompletedEvent)
SetEvent(sif->CallsCompletedEvent);
HeapFree(GetProcessHeap(), 0, sif); HeapFree(GetProcessHeap(), 0, sif);
} }
} }
...@@ -888,8 +889,10 @@ RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid ...@@ -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))) && if ((!IfSpec || !memcmp(&If->InterfaceId, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER))) &&
UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) { UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) {
list_remove(&cif->entry); list_remove(&cif->entry);
TRACE("unregistering cif %p\n", cif);
if (cif->CurrentCalls) { if (cif->CurrentCalls) {
completed = FALSE; completed = FALSE;
cif->Delete = TRUE;
if (WaitForCallsToComplete) if (WaitForCallsToComplete)
cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL); cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL);
} }
......
...@@ -73,6 +73,7 @@ typedef struct _RpcServerInterface ...@@ -73,6 +73,7 @@ typedef struct _RpcServerInterface
/* set when unregistering interface to let the caller of /* set when unregistering interface to let the caller of
* RpcServerUnregisterIf* know that all calls have finished */ * RpcServerUnregisterIf* know that all calls have finished */
HANDLE CallsCompletedEvent; HANDLE CallsCompletedEvent;
BOOL Delete; /* delete when the last call finishes */
} RpcServerInterface; } RpcServerInterface;
void RPCRT4_new_client(RpcConnection* conn); void RPCRT4_new_client(RpcConnection* conn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment