- Fix a bug in GetSocketStructure that resulted in us missing the last entry of the list
- Remove an "optimization" which was supposed to find an unused socket entry (which it almost never did) but now just corrupts the linked list by trashing our NextSocket pointer

svn path=/trunk/; revision=47656
This commit is contained in:
Cameron Gutman 2010-06-07 05:40:08 +00:00
parent adc324f5c9
commit b2c96e402d

View file

@ -60,7 +60,7 @@ WSPSocket(int AddressFamily,
ULONG SizeOfEA;
PAFD_CREATE_PACKET AfdPacket;
HANDLE Sock;
PSOCKET_INFORMATION Socket = NULL, PrevSocket = NULL;
PSOCKET_INFORMATION Socket = NULL;
PFILE_FULL_EA_INFORMATION EABuffer = NULL;
PHELPER_DATA HelperData;
PVOID HelperDLLContext;
@ -260,17 +260,6 @@ WSPSocket(int AddressFamily,
/* Save Handle */
Socket->Handle = (SOCKET)Sock;
/* XXX See if there's a structure we can reuse -- We need to do this
* more properly. */
PrevSocket = GetSocketStructure( (SOCKET)Sock );
if( PrevSocket )
{
RtlCopyMemory( PrevSocket, Socket, sizeof(*Socket) );
RtlFreeHeap( GlobalHeap, 0, Socket );
Socket = PrevSocket;
}
/* Save Group Info */
if (g != 0)
{
@ -2325,15 +2314,8 @@ GetSocketStructure(SOCKET Handle)
{
PSOCKET_INFORMATION CurrentSocket;
if (!SocketListHead)
return NULL;
/* This is a special case */
if (SocketListHead->Handle == Handle)
return SocketListHead;
CurrentSocket = SocketListHead;
while (CurrentSocket->NextSocket)
while (CurrentSocket)
{
if (CurrentSocket->Handle == Handle)
return CurrentSocket;