ntoskrnl.exe: Don't add device to the list if IoCreateDevice fails.

Spotted by Zebediah Figura.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-04-08 14:03:27 +02:00 committed by Alexandre Julliard
parent 061f65f9aa
commit 80d53026bf

View file

@ -1502,9 +1502,6 @@ NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
device->DeviceType = type;
device->StackSize = 1;
device->NextDevice = driver->DeviceObject;
driver->DeviceObject = device;
SERVER_START_REQ( create_device )
{
req->rootdir = 0;
@ -1521,6 +1518,9 @@ NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
return status;
}
device->NextDevice = driver->DeviceObject;
driver->DeviceObject = device;
*ret_device = device;
return STATUS_SUCCESS;
}