Commit 9e3f1a15 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

wineusb: Fix memory leaks on error paths in usb_submit_urb (scan-build).

parent dcb123fa
......@@ -449,7 +449,10 @@ static NTSTATUS usb_submit_urb(void *args)
transfer_ctx->transfer_buffer = params->transfer_buffer;
if (!(transfer = libusb_alloc_transfer(0)))
{
free(transfer_ctx);
return STATUS_NO_MEMORY;
}
irp->Tail.Overlay.DriverContext[0] = transfer;
if (pipe.type == UsbdPipeTypeBulk)
......@@ -465,6 +468,7 @@ static NTSTATUS usb_submit_urb(void *args)
else
{
WARN("Invalid pipe type %#x.\n", pipe.type);
free(transfer_ctx);
libusb_free_transfer(transfer);
return USBD_STATUS_INVALID_PIPE_HANDLE;
}
......@@ -489,11 +493,15 @@ static NTSTATUS usb_submit_urb(void *args)
transfer_ctx->transfer_buffer = params->transfer_buffer;
if (!(transfer = libusb_alloc_transfer(0)))
{
free(transfer_ctx);
return STATUS_NO_MEMORY;
}
irp->Tail.Overlay.DriverContext[0] = transfer;
if (!(buffer = malloc(sizeof(struct libusb_control_setup) + req->TransferBufferLength)))
{
free(transfer_ctx);
libusb_free_transfer(transfer);
return STATUS_NO_MEMORY;
}
......@@ -549,11 +557,15 @@ static NTSTATUS usb_submit_urb(void *args)
FIXME("Unhandled flags %#x.\n", (int)req->TransferFlags);
if (!(transfer = libusb_alloc_transfer(0)))
{
free(transfer_ctx);
return STATUS_NO_MEMORY;
}
irp->Tail.Overlay.DriverContext[0] = transfer;
if (!(buffer = malloc(sizeof(struct libusb_control_setup) + req->TransferBufferLength)))
{
free(transfer_ctx);
libusb_free_transfer(transfer);
return STATUS_NO_MEMORY;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment