diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-20 10:30:45 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-20 10:30:45 -0200 |
commit | 529d4a90d815016b14241e3473fe222df8739d32 (patch) | |
tree | c1afded4f90fe2eafa36bcfbe40f1e8706affaf8 /linux/drivers/media/video/cpia2 | |
parent | 135dede93c0407cdaa4a74f77fa2de62048f0df3 (diff) | |
download | mediapointer-dvb-s2-529d4a90d815016b14241e3473fe222df8739d32.tar.gz mediapointer-dvb-s2-529d4a90d815016b14241e3473fe222df8739d32.tar.bz2 |
Cpia2/cpia2_usb.c: fix error-path leak
From: Amit Choudhary <amit2030@gmail.com>
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 'linux/drivers/media/video/cpia2')
-rw-r--r-- | linux/drivers/media/video/cpia2/cpia2_usb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/linux/drivers/media/video/cpia2/cpia2_usb.c b/linux/drivers/media/video/cpia2/cpia2_usb.c index 0d4bb91dc..87442ede0 100644 --- a/linux/drivers/media/video/cpia2/cpia2_usb.c +++ b/linux/drivers/media/video/cpia2/cpia2_usb.c @@ -648,6 +648,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; } } |