Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index d20b39efe15..b0ac64e8b51 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -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 ); } }