Properly handle destroying the first connection in the connection

cache.
oldstable
Ove Kaaven 2004-01-09 00:34:53 +00:00 committed by Alexandre Julliard
parent f7b47f7a5c
commit cb6c83dfc3
1 changed files with 7 additions and 3 deletions

View File

@ -136,9 +136,13 @@ RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection)
EnterCriticalSection(&conn_cache_cs);
PrevConnection = conn_cache;
while (PrevConnection && PrevConnection->Next != Connection)
PrevConnection = PrevConnection->Next;
if (PrevConnection) PrevConnection->Next = Connection->Next;
if (PrevConnection == Connection) {
conn_cache = Connection->Next;
} else {
while (PrevConnection && PrevConnection->Next != Connection)
PrevConnection = PrevConnection->Next;
if (PrevConnection) PrevConnection->Next = Connection->Next;
}
LeaveCriticalSection(&conn_cache_cs);
RPCRT4_CloseConnection(Connection);