mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:12:59 +00:00
[USBSTOR] Do not leak fields of DeviceExtensions upon device removal
This commit is contained in:
parent
fa530aee92
commit
40b25634ff
2 changed files with 24 additions and 1 deletions
|
@ -108,8 +108,27 @@ USBSTOR_FdoHandleRemoveDevice(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Freeing everything in DeviceExtension
|
||||||
|
ASSERT(
|
||||||
|
DeviceExtension->DeviceDescriptor &&
|
||||||
|
DeviceExtension->ConfigurationDescriptor &&
|
||||||
|
DeviceExtension->InterfaceInformation &&
|
||||||
|
DeviceExtension->ResetDeviceWorkItem
|
||||||
|
);
|
||||||
|
|
||||||
|
ExFreePoolWithTag(DeviceExtension->DeviceDescriptor, USB_STOR_TAG);
|
||||||
|
ExFreePoolWithTag(DeviceExtension->ConfigurationDescriptor, USB_STOR_TAG);
|
||||||
|
ExFreePoolWithTag(DeviceExtension->InterfaceInformation, USB_STOR_TAG);
|
||||||
|
IoFreeWorkItem(DeviceExtension->ResetDeviceWorkItem);
|
||||||
|
|
||||||
|
if (DeviceExtension->SerialNumber)
|
||||||
|
{
|
||||||
|
ExFreePoolWithTag(DeviceExtension->SerialNumber, USB_STOR_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
// Send the IRP down the stack
|
// Send the IRP down the stack
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Status = IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
|
Status = IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
|
||||||
|
|
||||||
// Detach from the device stack
|
// Detach from the device stack
|
||||||
|
|
|
@ -575,6 +575,10 @@ USBSTOR_PdoHandlePnp(
|
||||||
bDelete = FALSE;
|
bDelete = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up the device extension
|
||||||
|
ASSERT(DeviceExtension->InquiryData);
|
||||||
|
ExFreePoolWithTag(DeviceExtension->InquiryData, USB_STOR_TAG);
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue