V4L/DVB (8884): em28xx-audio: fix memory leak
authorDouglas Schilling Landgraf <dougsland@linuxtv.org>
Thu, 4 Sep 2008 14:20:20 +0000 (11:20 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Sep 2008 11:26:01 +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/em28xx/em28xx-audio.c

index 3c006103c1eb369c4817fd74522ef7ffebc91e61..08cb4e7711a52f06a8f93b23854bee15bc5099e9 100644 (file)
@@ -161,8 +161,14 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
 
                memset(dev->adev->transfer_buffer[i], 0x80, sb_size);
                urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
-               if (!urb)
+               if (!urb) {
+                       em28xx_errdev("usb_alloc_urb failed!\n");
+                       for (j = 0; j < i; j++) {
+                               usb_free_urb(dev->adev->urb[j]);
+                               kfree(dev->adev->transfer_buffer[j]);
+                       }
                        return -ENOMEM;
+               }
 
                urb->dev = dev->udev;
                urb->context = dev;