[media] EM28xx - Fix memory leak on disconnect or error
authorChris Rankin <rankincj@yahoo.com>
Sun, 4 Sep 2011 18:38:14 +0000 (15:38 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 18 Sep 2011 10:58:01 +0000 (07:58 -0300)
Release the dev->alt_max_pkt_size buffer in all cases.

Signed-off-by: Chris Rankin <rankincj@yahoo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-video.c

index 5fddcd0..013e946 100644 (file)
@@ -3201,6 +3201,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
        retval = em28xx_init_dev(&dev, udev, interface, nr);
        if (retval) {
                mutex_unlock(&dev->lock);
+               kfree(dev->alt_max_pkt_size);
                kfree(dev);
                goto err;
        }
index d176dc0..61f35c8 100644 (file)
@@ -2200,6 +2200,7 @@ static int em28xx_v4l2_close(struct file *filp)
                   free the remaining resources */
                if (dev->state & DEV_DISCONNECTED) {
                        em28xx_release_resources(dev);
+                       kfree(dev->alt_max_pkt_size);
                        kfree(dev);
                        return 0;
                }