aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorAmit Choudhary <amit2030@gmail.com>2006-12-20 07:30:45 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-12-27 11:19:51 -0500
commitd82d418a3af4d7d07151f9d45ca20f2ce61289a0 (patch)
tree87c4be0dd62e0bdcb153b514fe24f79511fe33df /drivers/media/video
parentcb2c7b4927c8f376b7ba9557978d8c59ed472664 (diff)
V4L/DVB (4990): Cpia2/cpia2_usb.c: fix error-path leak
Free previously allocated memory (in array elements) if kmalloc() returns NULL in submit_urbs(). Signed-off-by: Amit Choudhary <amit2030@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cpia2/cpia2_usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/video/cpia2/cpia2_usb.c b/drivers/media/video/cpia2/cpia2_usb.c
index 28dc6a1a1e43..d8e929863a88 100644
--- a/drivers/media/video/cpia2/cpia2_usb.c
+++ b/drivers/media/video/cpia2/cpia2_usb.c
@@ -640,6 +640,10 @@ static int submit_urbs(struct camera_data *cam)
640 cam->sbuf[i].data = 640 cam->sbuf[i].data =
641 kmalloc(FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL); 641 kmalloc(FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL);
642 if (!cam->sbuf[i].data) { 642 if (!cam->sbuf[i].data) {
643 while (--i >= 0) {
644 kfree(cam->sbuf[i].data);
645 cam->sbuf[i].data = NULL;
646 }
643 return -ENOMEM; 647 return -ENOMEM;
644 } 648 }
645 } 649 }