[ros-diffs] [cgutman] 35398: - Make sure we successfully allocated ConnectionReturnInfo and ConnectionCallInfo - Make sure ObReferenceObjectByHandle was successful

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sat Aug 16 23:16:42 CEST 2008


Author: cgutman
Date: Sat Aug 16 16:16:41 2008
New Revision: 35398

URL: http://svn.reactos.org/svn/reactos?rev=35398&view=rev
Log:
 - Make sure we successfully allocated ConnectionReturnInfo and ConnectionCallInfo
 - Make sure ObReferenceObjectByHandle was successful

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/network/afd/afd/listen.c?rev=35398&r1=35397&r2=35398&view=diff
==============================================================================
--- 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] Sat Aug 16 16:16:41 2008
@@ -188,14 +188,17 @@
 
     if( !NT_SUCCESS(Status) ) return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
 
-    FCB->State = SOCKET_STATE_LISTENING;
-
     TdiBuildNullConnectionInfo
 	( &FCB->ListenIrp.ConnectionCallInfo,
 	  FCB->LocalAddress->Address[0].AddressType );
     TdiBuildNullConnectionInfo
 	( &FCB->ListenIrp.ConnectionReturnInfo,
 	  FCB->LocalAddress->Address[0].AddressType );
+
+    if( !FCB->ListenIrp.ConnectionReturnInfo || !FCB->ListenIrp.ConnectionCallInfo )
+	return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
+
+    FCB->State = SOCKET_STATE_LISTENING;
 
     Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
 			FCB->Connection.Object,
@@ -271,6 +274,8 @@
 		( &FCB->ListenIrp.ConnectionReturnInfo,
 		  FCB->LocalAddress->Address[0].AddressType );
 
+	    if( !FCB->ListenIrp.ConnectionReturnInfo ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
+
 	    Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
 				FCB->Connection.Object,
 				&FCB->ListenIrp.ConnectionCallInfo,
@@ -305,6 +310,8 @@
 		  (PVOID *)&NewFileObject,
 		  NULL );
 
+            if( !NT_SUCCESS(Status) ) UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
+
             ASSERT(NewFileObject != FileObject);
             ASSERT(NewFileObject->FsContext != FCB);
 



More information about the Ros-diffs mailing list