kernel-fxtec-pro1x/drivers/media/video/tlg2300
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
..
Kconfig [media] rc: rename the remaining things to rc_core 2010-12-29 08:16:50 -02:00
Makefile V4L/DVB: Add driver for Telegent tlg2300 2010-02-26 15:10:58 -03:00
pd-alsa.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pd-common.h V4L/DVB: media/video/tlg2300: fix build when CONFIG_PM=n 2010-02-26 15:11:02 -03:00
pd-dvb.c V4L/DVB: tlg2300: cleanups when power management is not configured 2010-05-18 00:46:24 -03:00
pd-main.c Merge branch 'usb-next' into musb-merge 2010-12-16 10:05:06 -08:00
pd-radio.c V4L/DVB: tlg2300: make local variables and functions static 2010-05-18 00:46:25 -03:00
pd-video.c [media] media, tlg2300: Fix memory leak in alloc_bulk_urbs_generic() 2011-01-19 11:45:45 -02:00
vendorcmds.h V4L/DVB: Add driver for Telegent tlg2300 2010-02-26 15:10:58 -03:00