V4L/DVB (6350): V4L: possible leak in em28xx_init_isoc
authorFlorin Malita <fmalita@gmail.com>
Mon, 15 Oct 2007 15:59:18 +0000 (12:59 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 22 Oct 2007 14:01:49 +0000 (12:01 -0200)
Coverity (CID 1929) spotted the following: if a transfer buffer
allocation fails, the last allocated urb is leaked (it hasn't been
stored in dev->urb[] yet so em28xx_uninit_isoc misses it). The patch
also includes a small typo fix.

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/em28xx/em28xx-core.c

index d3282ec62c5be2e1382a2bc01dc5f4755bdd2a7e..d56484f204677105c9fd435fdeb7bf8aca30ed75 100644 (file)
@@ -648,7 +648,7 @@ void em28xx_uninit_isoc(struct em28xx *dev)
  */
 int em28xx_init_isoc(struct em28xx *dev)
 {
-       /* change interface to 3 which allowes the biggest packet sizes */
+       /* change interface to 3 which allows the biggest packet sizes */
        int i, errCode;
        const int sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size;
 
@@ -673,6 +673,7 @@ int em28xx_init_isoc(struct em28xx *dev)
                                        ("unable to allocate %i bytes for transfer buffer %i\n",
                                         sb_size, i);
                        em28xx_uninit_isoc(dev);
+                       usb_free_urb(urb);
                        return -ENOMEM;
                }
                memset(dev->transfer_buffer[i], 0, sb_size);