USB SL811HS HCD: Fix memory leak in sl811h_urb_enqueue()
authorJesper Juhl <jj@chaosbits.net>
Sun, 23 Jan 2011 22:08:31 +0000 (23:08 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 4 Feb 2011 00:42:17 +0000 (16:42 -0800)
commit2bd15f1f49629f110bbbbc5a2a226bec892de87c
tree41bff6cce241bd43d657ee011a99d732bbea4e11
parentb14de3857227cd978f515247853fd15cc2425d3e
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>
drivers/usb/host/sl811-hcd.c