diff --git a/drivers/usb/usbstor/fdo.c b/drivers/usb/usbstor/fdo.c index 15af86f095a..ebf2d1976a4 100644 --- a/drivers/usb/usbstor/fdo.c +++ b/drivers/usb/usbstor/fdo.c @@ -61,7 +61,7 @@ USBSTOR_FdoHandleDeviceRelations( } } - DeviceRelations = ExFreePoolWithTag(PagedPool, sizeof(DEVICE_RELATIONS) + (DeviceCount-1) * sizeof(PDEVICE_OBJECT), USB_STOR_TAG); + DeviceRelations = ExAllocatePoolWithTag(PagedPool, sizeof(DEVICE_RELATIONS) + (DeviceCount - 1) * sizeof(PDEVICE_OBJECT), USB_STOR_TAG); if (!DeviceRelations) { Irp->IoStatus.Information = 0; @@ -70,6 +70,8 @@ USBSTOR_FdoHandleDeviceRelations( return STATUS_INSUFFICIENT_RESOURCES; } + DeviceRelations->Count = 0; + // add device objects for (Index = 0; Index < max(DeviceExtension->MaxLUN, 1); Index++) {