Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d82d418a3af4d7d07151f9d45ca20f2ce61289a0 Commit: d82d418a3af4d7d07151f9d45ca20f2ce61289a0 Parent: cb2c7b4927c8f376b7ba9557978d8c59ed472664 Author: Amit Choudhary <[EMAIL PROTECTED]> AuthorDate: Wed Dec 20 09:30:45 2006 -0300 Committer: Mauro Carvalho Chehab <[EMAIL PROTECTED]> CommitDate: Wed Dec 27 14:19:51 2006 -0200
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 <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]> --- 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; } } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html