diff mbox series

[1/4] usb: usbtmc: Fix memory leak in usbtmc_ioctl_request

Message ID 20180924233032.2379-2-guido@kiener-muenchen.de (mailing list archive)
State New, archived
Headers show
Series usb: usbtmc: Fix changes for compatible IVI/VISA library | expand

Commit Message

Guido Kiener Sept. 24, 2018, 11:30 p.m. UTC
From: Guido Kiener <guido.kiener@rohde-schwarz.com>

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: 658f24f4523e ("usb: usbtmc: Add ioctl for generic requests on control")
---
 drivers/usb/class/usbtmc.c | 4 ----
 1 file changed, 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 0fcb81a1399b..dfbcf418dad7 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -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;