Fixed bug in IO manager that caused crash when trying to open a file on a non existant device

Fixed memory leaks in object manager

svn path=/trunk/; revision=964
This commit is contained in:
Phillip Susi 2000-01-25 06:31:25 +00:00
parent 3a18299c0f
commit 52404fd1c8
2 changed files with 10 additions and 2 deletions

View file

@ -67,7 +67,11 @@ NTSTATUS IopCreateFile(PVOID ObjectBody,
DPRINT("DeviceObject was NULL\n"); DPRINT("DeviceObject was NULL\n");
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
if( BODY_TO_HEADER( Parent )->ObjectType != IoDeviceType )
{
DPRINT( "Parent is not a device type\n" );
return STATUS_UNSUCCESSFUL;
}
Status = ObReferenceObjectByPointer(DeviceObject, Status = ObReferenceObjectByPointer(DeviceObject,
STANDARD_RIGHTS_REQUIRED, STANDARD_RIGHTS_REQUIRED,
IoDeviceType, IoDeviceType,

View file

@ -176,7 +176,10 @@ PVOID ObCreateObject(PHANDLE Handle,
ObjectAttributes); ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(NULL); ObDereferenceObject( Parent );
RtlFreeUnicodeString( &Header->Name );
ExFreePool( Header );
return(NULL);
} }
} }
return(HEADER_TO_BODY(Header)); return(HEADER_TO_BODY(Header));
@ -260,6 +263,7 @@ NTSTATUS ObPerformRetentionChecks(POBJECT_HEADER Header)
if (Header->Name.Buffer != NULL) if (Header->Name.Buffer != NULL)
{ {
ObRemoveEntry(Header); ObRemoveEntry(Header);
RtlFreeUnicodeString( &Header->Name );
} }
DPRINT("ObPerformRetentionChecks() = Freeing object\n"); DPRINT("ObPerformRetentionChecks() = Freeing object\n");
ExFreePool(Header); ExFreePool(Header);