2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 09:43:59 +08:00

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>
This commit is contained in:
Amit Choudhary 2006-12-20 09:30:45 -03:00 committed by Mauro Carvalho Chehab
parent cb2c7b4927
commit d82d418a3a

View File

@ -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;
}
}