Author: cgutman
Date: Tue Apr 7 09:07:09 2009
New Revision: 40412
URL:
http://svn.reactos.org/svn/reactos?rev=40412&view=rev
Log:
- Don't leave a bad handle or object pointer
- Make sure we don't try to dereference a non-referenced handle
Modified:
trunk/reactos/drivers/network/afd/afd/lock.c
trunk/reactos/drivers/network/afd/afd/tdi.c
Modified: trunk/reactos/drivers/network/afd/afd/lock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/lo…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] Tue Apr 7 09:07:09 2009
@@ -187,6 +187,9 @@
(PVOID*)&FileObjects[i].Handle,
NULL );
}
+
+ if( !NT_SUCCESS(Status) )
+ FileObjects[i].Handle = 0;
}
if( !NT_SUCCESS(Status) ) {
Modified: trunk/reactos/drivers/network/afd/afd/tdi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/td…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/tdi.c [iso-8859-1] Tue Apr 7 09:07:09 2009
@@ -137,14 +137,17 @@
if (!NT_SUCCESS(Status)) {
AFD_DbgPrint(MIN_TRACE, ("ObReferenceObjectByHandle() failed with status
(0x%X).\n", Status));
ZwClose(*Handle);
- *Handle = NULL;
} else {
AFD_DbgPrint(MAX_TRACE, ("Got handle (0x%X) Object (0x%X)\n",
*Handle, *Object));
}
} else {
AFD_DbgPrint(MIN_TRACE, ("ZwCreateFile() failed with status (0x%X)\n",
Status));
+ }
+
+ if (!NT_SUCCESS(Status)) {
*Handle = NULL;
+ *Object = NULL;
}
return Status;