usb: usbtmc: Fix memory leak in usbtmc_ioctl_request

Kernel memory is allocated twice in new function
usbtmc_ioctl_request and creates a memory leak.
This fix removes the superfluous kmalloc().

Signed-off-by: Guido Kiener <guido.kiener@rohde-schwarz.com>
Fixes: 658f24f452 ("usb: usbtmc: Add ioctl for generic requests on control")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Guido Kiener 2018-09-25 01:30:29 +02:00 committed by Greg Kroah-Hartman
parent 4d2a863fe9
commit 100f2cdead

View File

@ -1895,10 +1895,6 @@ static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
if (res)
return -EFAULT;
buffer = kmalloc(request.req.wLength, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
if (request.req.wLength > USBTMC_BUFSIZE)
return -EMSGSIZE;