1
linux/drivers/media
Jesper Juhl fd01ad9894 [media] media, tlg2300: Fix memory leak in alloc_bulk_urbs_generic()
Hi,

While reading
drivers/media/video/tlg2300/pd-video.c::alloc_bulk_urbs_generic() I
noticed that

 - We don't free the memory allocated to 'urb' if the call to
   usb_alloc_coherent() fails.
 - If the 'num' argument to the function is ever <= 0 we'll return an
   uninitialized variable 'i' to the caller.

The following patch addresses both of the above by a) calling
usb_free_urb() when usb_alloc_coherent() fails and by explicitly
initializing 'i' to zero.
I also moved the variables 'mem' and 'urb' inside the for loop. This does
not actually make any difference, it just seemed more correct to me to let
variables exist only in the innermost scope they are used.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:45 -02:00
..
common [media] saa7134: Kworld SBTVD: make both analog and digital to work 2011-01-19 11:45:28 -02:00
dvb [media] frontends/ix2505v: Remember to free allocated memory in failure path 2011-01-19 11:45:44 -02:00
radio [media] radio-si470x: Always report support for RDS 2011-01-19 11:45:15 -02:00
rc [media] rc-dib0700-nec: Fix keytable for Pixelview SBTVD 2011-01-19 11:45:16 -02:00
video [media] media, tlg2300: Fix memory leak in alloc_bulk_urbs_generic() 2011-01-19 11:45:45 -02:00
Kconfig [media] dabusb: Move it to staging to be deprecated 2010-12-29 08:17:15 -02:00
Makefile [media] rename drivers/media/IR to drives/media/rc 2010-12-29 08:16:36 -02:00