summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/sl811-hcd.c
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2011-01-23 23:08:31 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-04 01:42:17 +0100
commit2bd15f1f49629f110bbbbc5a2a226bec892de87c (patch)
tree41bff6cce241bd43d657ee011a99d732bbea4e11 /drivers/usb/host/sl811-hcd.c
parentUSB: ti_usb: fix module removal (diff)
downloadlinux-2bd15f1f49629f110bbbbc5a2a226bec892de87c.tar.xz
linux-2bd15f1f49629f110bbbbc5a2a226bec892de87c.zip
USB SL811HS HCD: Fix memory leak in sl811h_urb_enqueue()
In drivers/usb/host/sl811-hcd.c::sl811h_urb_enqueue(), memory is allocated with kzalloc() and assigned to 'ep'. If we leave via the 'fail' label due to 'if (ep->maxpacket > H_MAXPACKET)', then 'ep' will go out of scope without having been assigned to anything, so we'll leak the memory we allocated. This patch fixes the leak by simply calling kfree(ep); before jumping to the 'fail' label. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/sl811-hcd.c')
-rw-r--r--drivers/usb/host/sl811-hcd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 990f06b89eaa..2e9602a10e9b 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -861,6 +861,7 @@ static int sl811h_urb_enqueue(
DBG("dev %d ep%d maxpacket %d\n",
udev->devnum, epnum, ep->maxpacket);
retval = -EINVAL;
+ kfree(ep);
goto fail;
}