- Don't leave a bad handle or object pointer

- Make sure we don't try to dereference a non-referenced handle

svn path=/trunk/; revision=40412
This commit is contained in:
Cameron Gutman 2009-04-07 05:07:09 +00:00
parent 7025dd53e2
commit 5ee60afbf2
2 changed files with 7 additions and 1 deletions

View file

@ -187,6 +187,9 @@ PAFD_HANDLE LockHandles( PAFD_HANDLE HandleArray, UINT HandleCount ) {
(PVOID*)&FileObjects[i].Handle,
NULL );
}
if( !NT_SUCCESS(Status) )
FileObjects[i].Handle = 0;
}
if( !NT_SUCCESS(Status) ) {

View file

@ -137,14 +137,17 @@ static NTSTATUS TdiOpenDevice(
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;