V4L/DVB (8887): gspca: fix memory leak
authorDouglas Schilling Landgraf <dougsland@linuxtv.org>
Thu, 4 Sep 2008 14:23:06 +0000 (11:23 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Sep 2008 11:26:24 +0000 (08:26 -0300)
Free allocated memory

Cc: Jean-Francois Moine <moinejf@free.fr>
Cc: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Douglas Schilling Landgraf <dougsland@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index 7be69284da035b0475eb1f7bdb1b6c4cabf3ecaf..ed8935da58e0bf17a37c166002a2b89cd245d0dc 100644 (file)
@@ -459,6 +459,8 @@ 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]);
                        return -ENOMEM;
                }
                urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,