From 7148ac52fcdfa170d406537fe56088be3c7ac1e0 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Thu, 23 Feb 2017 09:28:20 +0000 Subject: [PATCH] [USBSTOR] - Fix error paths around SCSI_REQUEST_BLOCK::DataBuffer. Spotted by curiousone. CORE-12816 #resolve svn path=/trunk/; revision=73892 --- reactos/drivers/usb/usbstor/pdo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/usb/usbstor/pdo.c b/reactos/drivers/usb/usbstor/pdo.c index 22157bc3de5..b741542d2b7 100644 --- a/reactos/drivers/usb/usbstor/pdo.c +++ b/reactos/drivers/usb/usbstor/pdo.c @@ -1041,7 +1041,7 @@ USBSTOR_AllocateIrp( Request->DataBuffer = ExAllocatePoolWithTag(NonPagedPool, DataTransferLength, USB_STOR_TAG); - if (!Request) + if (!Request->DataBuffer) { // // no memory @@ -1061,6 +1061,7 @@ USBSTOR_AllocateIrp( // no memory // IoFreeIrp(Irp); + ExFreePoolWithTag(Request->DataBuffer, USB_STOR_TAG); ExFreePoolWithTag(Request, USB_STOR_TAG); return STATUS_INSUFFICIENT_RESOURCES; } @@ -1173,6 +1174,7 @@ USBSTOR_SendIrp( // // free resources // + ExFreePoolWithTag(Request->DataBuffer, USB_STOR_TAG); ExFreePoolWithTag(Request, USB_STOR_TAG); IoFreeIrp(Irp); return Status;