V4L/DVB (8926): gspca: Bad fix of leak memory (changeset 43d2ead315b1).
authorJean-Francois Moine <moinejf@free.fr>
Fri, 5 Sep 2008 15:49:54 +0000 (12:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 5 Oct 2008 01:28:14 +0000 (22:28 -0300)
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index ed8935da58e0bf17a37c166002a2b89cd245d0dc..ac95c55887df4b38eb1cd8c4478538c53e042aef 100644 (file)
@@ -459,8 +459,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
                urb = usb_alloc_urb(npkt, GFP_KERNEL);
                if (!urb) {
                        err("usb_alloc_urb failed");
-                       for (i = 0; i < n; i++)
-                               usb_free_urb(gspca_dev->urb[i]);
+                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
                urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,
@@ -470,8 +469,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
 
                if (urb->transfer_buffer == NULL) {
                        usb_free_urb(urb);
-                       destroy_urbs(gspca_dev);
                        err("usb_buffer_urb failed");
+                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
                gspca_dev->urb[n] = urb;