]>
Commit | Line | Data |
---|---|---|
0e6078b8 GKH |
1 | From acbf0e5263de563e25f7c104868e4490b9e72b13 Mon Sep 17 00:00:00 2001 |
2 | From: Johan Hovold <jhovold@gmail.com> | |
3 | Date: Thu, 25 Oct 2012 10:29:12 +0200 | |
4 | Subject: USB: opticon: fix memory leak in error path | |
5 | ||
6 | From: Johan Hovold <jhovold@gmail.com> | |
7 | ||
8 | commit acbf0e5263de563e25f7c104868e4490b9e72b13 upstream. | |
9 | ||
10 | Fix memory leak in write error path. | |
11 | ||
12 | Signed-off-by: Johan Hovold <jhovold@gmail.com> | |
13 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
14 | ||
15 | --- | |
16 | drivers/usb/serial/opticon.c | 4 +++- | |
17 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
18 | ||
19 | --- a/drivers/usb/serial/opticon.c | |
20 | +++ b/drivers/usb/serial/opticon.c | |
21 | @@ -297,7 +297,7 @@ static int opticon_write(struct tty_stru | |
22 | if (!dr) { | |
23 | dev_err(&port->dev, "out of memory\n"); | |
24 | count = -ENOMEM; | |
25 | - goto error; | |
26 | + goto error_no_dr; | |
27 | } | |
28 | ||
29 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; | |
30 | @@ -327,6 +327,8 @@ static int opticon_write(struct tty_stru | |
31 | ||
32 | return count; | |
33 | error: | |
34 | + kfree(dr); | |
35 | +error_no_dr: | |
36 | usb_free_urb(urb); | |
37 | error_no_urb: | |
38 | kfree(buffer); |