summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2012-10-25 10:29:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-31 10:02:59 -0700
commited7d272780f5185e9ca38cd63effd06a43c00cb1 (patch)
tree822aefe7d18ca9040e9c4dc7c9c7193c50a7ab0b /drivers
parentce11958aa9b27e162fe2c1a23e50e318de0319c4 (diff)
downloadlinux-3.10-ed7d272780f5185e9ca38cd63effd06a43c00cb1.tar.gz
linux-3.10-ed7d272780f5185e9ca38cd63effd06a43c00cb1.tar.bz2
linux-3.10-ed7d272780f5185e9ca38cd63effd06a43c00cb1.zip
USB: opticon: fix memory leak in error path
commit acbf0e5263de563e25f7c104868e4490b9e72b13 upstream. Fix memory leak in write error path. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/opticon.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index c661c9c2998..1f850065d15 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -297,7 +297,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
if (!dr) {
dev_err(&port->dev, "out of memory\n");
count = -ENOMEM;
- goto error;
+ goto error_no_dr;
}
dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
@@ -327,6 +327,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
return count;
error:
+ kfree(dr);
+error_no_dr:
usb_free_urb(urb);
error_no_urb:
kfree(buffer);