]> git.karo-electronics.de Git - linux-beck.git/commitdiff
V4L/DVB (8885): cpia2_usb: fix memory leak
authorDouglas Schilling Landgraf <dougsland@linuxtv.org>
Thu, 4 Sep 2008 14:21:03 +0000 (11:21 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Sep 2008 11:26:10 +0000 (08:26 -0300)
Free allocated memory

Signed-off-by: Douglas Schilling Landgraf <dougsland@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cpia2/cpia2_usb.c

index a4574740350df30cf6bd3cb84592b8c84d39f779..a8a199047cbde4c448dbfb736beedbb78d3c4e08 100644 (file)
@@ -632,7 +632,7 @@ int cpia2_usb_transfer_cmd(struct camera_data *cam,
 static int submit_urbs(struct camera_data *cam)
 {
        struct urb *urb;
-       int fx, err, i;
+       int fx, err, i, j;
 
        for(i=0; i<NUM_SBUF; ++i) {
                if (cam->sbuf[i].data)
@@ -657,6 +657,9 @@ static int submit_urbs(struct camera_data *cam)
                }
                urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
                if (!urb) {
+                       ERR("%s: usb_alloc_urb error!\n", __func__);
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(cam->sbuf[j].urb);
                        return -ENOMEM;
                }