diff options
author | Amit Choudhary <amit2030@gmail.com> | 2006-12-20 09:30:45 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-27 14:19:51 -0200 |
commit | d82d418a3af4d7d07151f9d45ca20f2ce61289a0 (patch) | |
tree | 87c4be0dd62e0bdcb153b514fe24f79511fe33df | |
parent | cb2c7b4927c8f376b7ba9557978d8c59ed472664 (diff) | |
download | op-kernel-dev-d82d418a3af4d7d07151f9d45ca20f2ce61289a0.zip op-kernel-dev-d82d418a3af4d7d07151f9d45ca20f2ce61289a0.tar.gz |
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>
-rw-r--r-- | drivers/media/video/cpia2/cpia2_usb.c | 4 |
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 28dc6a1..d8e9298 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) cam->sbuf[i].data = kmalloc(FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL); if (!cam->sbuf[i].data) { + while (--i >= 0) { + kfree(cam->sbuf[i].data); + cam->sbuf[i].data = NULL; + } return -ENOMEM; } } |