From 02d309566416f898fc69b7a31bd08a64b26cb61e Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sat, 9 Apr 2005 09:40:44 +0000 Subject: [PATCH] Fixed the dereferencing of an existing named object in IoCreateFile. svn path=/trunk/; revision=14561 --- reactos/ntoskrnl/io/create.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/io/create.c b/reactos/ntoskrnl/io/create.c index b8770905e49..4bf6fb83729 100644 --- a/reactos/ntoskrnl/io/create.c +++ b/reactos/ntoskrnl/io/create.c @@ -344,8 +344,8 @@ IoCreateFile(OUT PHANDLE FileHandle, IN PVOID ExtraCreateParameters OPTIONAL, IN ULONG Options) { - PFILE_OBJECT FileObject; - PDEVICE_OBJECT DeviceObject = NULL; + PFILE_OBJECT FileObject = NULL; + PDEVICE_OBJECT DeviceObject; PIRP Irp; PIO_STACK_LOCATION StackLoc; IO_SECURITY_CONTEXT SecurityContext; @@ -460,23 +460,23 @@ IoCreateFile(OUT PHANDLE FileHandle, AccessMode, (PVOID*)&DeviceObject, NULL); - ObDereferenceObject (DeviceObject); + ZwClose(LocalHandle); if (!NT_SUCCESS(Status)) { return Status; } if (BODY_TO_HEADER(DeviceObject)->ObjectType != IoDeviceObjectType) { - ZwClose(LocalHandle); + ObDereferenceObject (DeviceObject); return STATUS_OBJECT_NAME_COLLISION; } FileObject = IoCreateStreamFileObject(NULL, DeviceObject); - ZwClose(LocalHandle); + ObDereferenceObject (DeviceObject); } } - if (DeviceObject == NULL) + if (FileObject == NULL) { Status = ObCreateObject(AccessMode, IoFileObjectType,