Author: cgutman Date: Fri Aug 29 21:53:20 2008 New Revision: 35786
URL: http://svn.reactos.org/svn/reactos?rev=35786&view=rev Log: - Check if TdiBuildNullConnectionInfo completed successfully - Add a comment - Fail if we can't allocate Qelt
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/listen.c
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/listen.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/netw... ============================================================================== --- branches/aicom-network-fixes/drivers/network/afd/afd/listen.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/drivers/network/afd/afd/listen.c [iso-8859-1] Fri Aug 29 21:53:20 2008 @@ -98,7 +98,7 @@ ( PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context ) { - NTSTATUS Status = STATUS_FILE_CLOSED; + NTSTATUS Status = STATUS_SUCCESS; PAFD_FCB FCB = (PAFD_FCB)Context; PAFD_TDI_OBJECT_QELT Qelt;
@@ -107,7 +107,7 @@ return STATUS_CANCELLED; }
- if( !SocketAcquireStateLock( FCB ) ) return Status; + if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED;
FCB->ListenIrp.InFlightRequest = NULL;
@@ -122,8 +122,10 @@
Qelt = ExAllocatePool( NonPagedPool, sizeof(*Qelt) ); if( !Qelt ) { + /* Is this correct? */ TdiCloseDevice( FCB->Connection.Handle, FCB->Connection.Object ); + Status = STATUS_NO_MEMORY; } else { UINT AddressType = FCB->LocalAddress->Address[0].AddressType; @@ -136,11 +138,12 @@ ConnectionReturnInfo->RemoteAddress));
TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType ); - TaCopyTransportAddressInPlace - ( Qelt->ConnInfo->RemoteAddress, - FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress ); - - InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry ); + if( Qelt->ConnInfo ) { + TaCopyTransportAddressInPlace + ( Qelt->ConnInfo->RemoteAddress, + FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress ); + InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry ); + } else Status = STATUS_NO_MEMORY; }
/* Satisfy a pre-accept request if one is available */ @@ -168,7 +171,7 @@
SocketStateUnlock( FCB );
- return STATUS_SUCCESS; + return Status; }
NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,