ntoskrnl: Dereference the device children in IoDeleteDevice().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-08-20 19:01:24 -05:00 committed by Alexandre Julliard
parent 6460f72db4
commit e56e4f97a4
1 changed files with 9 additions and 1 deletions

View File

@ -1628,9 +1628,17 @@ void WINAPI IoDeleteDevice( DEVICE_OBJECT *device )
{
struct wine_device *wine_device = CONTAINING_RECORD(device, struct wine_device, device_obj);
DEVICE_OBJECT **prev = &device->DriverObject->DeviceObject;
DEVICE_RELATIONS *children;
unsigned int i;
while (*prev && *prev != device) prev = &(*prev)->NextDevice;
if (*prev) *prev = (*prev)->NextDevice;
ExFreePool( wine_device->children );
if ((children = wine_device->children))
{
for (i = 0; i < children->Count; ++i)
ObDereferenceObject( children->Objects[i] );
ExFreePool( children );
}
ObDereferenceObject( device );
}
}