diff options
author | David Vrabel <david.vrabel@csr.com> | 2009-12-07 08:50:40 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:55:26 -0500 |
commit | 2e9729d0f86094e52d14e8b9e17c0aad565ee477 (patch) | |
tree | 66c8fad3b1ecb67e0b2fd762ffd17565d3aaa135 /drivers/usb | |
parent | 0d370755dd4ad3d119818579cfa3eb2e9978b3eb (diff) |
USB: wusb: don't leak urb in certain error cases
Don't leak an urb in wusb_dev_alloc() if the following kmalloc() failed.
Reported-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/wusbcore/devconnect.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c index 4ac4300a3f9a..dced419f7aba 100644 --- a/drivers/usb/wusbcore/devconnect.c +++ b/drivers/usb/wusbcore/devconnect.c | |||
@@ -119,10 +119,12 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) | |||
119 | urb = usb_alloc_urb(0, GFP_KERNEL); | 119 | urb = usb_alloc_urb(0, GFP_KERNEL); |
120 | if (urb == NULL) | 120 | if (urb == NULL) |
121 | goto err; | 121 | goto err; |
122 | wusb_dev->set_gtk_urb = urb; | ||
122 | 123 | ||
123 | req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | 124 | req = kmalloc(sizeof(*req), GFP_KERNEL); |
124 | if (req == NULL) | 125 | if (req == NULL) |
125 | goto err; | 126 | goto err; |
127 | wusb_dev->set_gtk_req = req; | ||
126 | 128 | ||
127 | req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE; | 129 | req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE; |
128 | req->bRequest = USB_REQ_SET_DESCRIPTOR; | 130 | req->bRequest = USB_REQ_SET_DESCRIPTOR; |
@@ -130,9 +132,6 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) | |||
130 | req->wIndex = 0; | 132 | req->wIndex = 0; |
131 | req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength); | 133 | req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength); |
132 | 134 | ||
133 | wusb_dev->set_gtk_urb = urb; | ||
134 | wusb_dev->set_gtk_req = req; | ||
135 | |||
136 | return wusb_dev; | 135 | return wusb_dev; |
137 | err: | 136 | err: |
138 | wusb_dev_free(wusb_dev); | 137 | wusb_dev_free(wusb_dev); |