V4L/DVB (8885): cpia2_usb: fix memory leak

Free allocated memory

Signed-off-by: Douglas Schilling Landgraf <dougsland@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Douglas Schilling Landgraf and committed by
Mauro Carvalho Chehab
beeb82be ff9b3e43

+4 -1
+4 -1
drivers/media/video/cpia2/cpia2_usb.c
··· 632 static int submit_urbs(struct camera_data *cam) 633 { 634 struct urb *urb; 635 - int fx, err, i; 636 637 for(i=0; i<NUM_SBUF; ++i) { 638 if (cam->sbuf[i].data) ··· 657 } 658 urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL); 659 if (!urb) { 660 return -ENOMEM; 661 } 662
··· 632 static int submit_urbs(struct camera_data *cam) 633 { 634 struct urb *urb; 635 + int fx, err, i, j; 636 637 for(i=0; i<NUM_SBUF; ++i) { 638 if (cam->sbuf[i].data) ··· 657 } 658 urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL); 659 if (!urb) { 660 + ERR("%s: usb_alloc_urb error!\n", __func__); 661 + for (j = 0; j < i; j++) 662 + usb_free_urb(cam->sbuf[j].urb); 663 return -ENOMEM; 664 } 665